Skip to content
Snippets Groups Projects
Commit 491ebb25 authored by Mélodie Boillet's avatar Mélodie Boillet Committed by Yoann Schneider
Browse files

Remove metrics functions

parent f9783600
No related branches found
No related tags found
1 merge request!150Remove metrics functions
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment