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
f6577084
Verified
Commit
f6577084
authored
6 months ago
by
Yoann Schneider
Browse files
Options
Downloads
Patches
Plain Diff
Support the case where the model can predict NER entities but doesn't in that case
parent
c9e8d46f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!457
Support the case where the model can predict NER entities but doesn't in that case
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dan/ocr/predict/attention.py
+2
-1
2 additions, 1 deletion
dan/ocr/predict/attention.py
with
2 additions
and
1 deletion
dan/ocr/predict/attention.py
+
2
−
1
View file @
f6577084
...
...
@@ -44,7 +44,8 @@ def compute_offsets_by_level(full_text: str, level: Level, text_list: List[str])
"""
# offsets[idx] = number of characters between text_list[idx-1] and text_list[idx]
offsets
=
[
int
(
level
!=
Level
.
Char
)]
*
(
len
(
text_list
)
-
1
)
if
level
==
Level
.
NER
:
# Take entities into account if there are any
if
level
==
Level
.
NER
and
text_list
:
# Start after the first entity
cursor
=
len
(
text_list
[
0
])
for
idx
,
split
in
enumerate
(
text_list
[
1
:]):
...
...
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