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
491ebb25
Commit
491ebb25
authored
1 year ago
by
Mélodie Boillet
Committed by
Yoann Schneider
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Remove metrics functions
parent
f9783600
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!150
Remove metrics functions
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dan/manager/metrics.py
+0
-16
0 additions, 16 deletions
dan/manager/metrics.py
with
0 additions
and
16 deletions
dan/manager/metrics.py
+
0
−
16
View file @
491ebb25
...
...
@@ -178,13 +178,6 @@ class MetricManager:
return
self
.
epoch_metrics
[
name
]
def
keep_only_ner_tokens
(
str
,
tokens
):
"""
Remove all but ner tokens from string
"""
return
re
.
sub
(
"
([^
"
+
tokens
+
"
])
"
,
""
,
str
)
def
keep_all_but_ner_tokens
(
str
,
tokens
):
"""
Remove all ner tokens from string
...
...
@@ -208,15 +201,6 @@ def nb_chars_cer_from_string(gt, layout_tokens=None):
return
len
(
format_string_for_cer
(
gt
,
layout_tokens
))
def
edit_wer_from_string
(
gt
,
pred
,
layout_tokens
=
None
,
remove_punct
=
False
):
"""
Format and compute edit distance between two strings at word level
"""
split_gt
=
format_string_for_wer
(
gt
,
layout_tokens
,
remove_punct
)
split_pred
=
format_string_for_wer
(
pred
,
layout_tokens
,
remove_punct
)
return
edit_wer_from_formatted_split_text
(
split_gt
,
split_pred
)
def
format_string_for_wer
(
str
,
layout_tokens
,
remove_punct
=
False
):
"""
Format string for WER computation: remove layout tokens, treat punctuation as word, replace line break by space
...
...
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