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
Merge requests
!150
Remove metrics functions
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Remove metrics functions
remove-metrics-functions
into
main
Overview
0
Commits
1
Pipelines
0
Changes
1
Merged
Mélodie Boillet
requested to merge
remove-metrics-functions
into
main
1 year ago
Overview
0
Commits
1
Pipelines
0
Changes
1
Expand
Closes
#84 (closed)
0
0
Merge request reports
Compare
main
main (base)
and
latest version
latest version
be591494
1 commit,
1 year ago
1 file
+
0
−
16
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
dan/manager/metrics.py
+
0
−
16
Options
@@ -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
Loading