Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
DAN
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Container Registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Automatic Text Recognition
DAN
Commits
e14367f7
Commit
e14367f7
authored
2 years ago
by
Solene Tarride
Committed by
Mélodie Boillet
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix dataset extraction offset
parent
5641f4c8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!42
Fix dataset extraction offset
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dan/datasets/extract/utils.py
+4
-1
4 additions, 1 deletion
dan/datasets/extract/utils.py
with
4 additions
and
1 deletion
dan/datasets/extract/utils.py
+
4
−
1
View file @
e14367f7
...
...
@@ -22,6 +22,7 @@ def save_json(path, dict):
def
insert_token
(
text
,
count
,
start_token
,
end_token
,
offset
,
length
):
"""
Insert the given tokens at the right position in the text
start_token or end_token can be empty strings
"""
text
=
(
# Text before entity
...
...
@@ -35,7 +36,9 @@ def insert_token(text, count, start_token, end_token, offset, length):
# Text after entity
+
text
[
count
+
1
+
offset
+
length
:]
)
return
text
,
count
+
2
token_offset
=
len
(
start_token
)
+
len
(
end_token
)
return
text
,
count
+
token_offset
def
parse_tokens
(
filename
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment