diff options
author | Pherkel | 2023-09-04 22:55:27 +0200 |
---|---|---|
committer | GitHub | 2023-09-04 22:55:27 +0200 |
commit | 93e49e708fa59613406249069d31c2f6c8f2d2ab (patch) | |
tree | 9f413c226283db990116c9559ffffb9124b911d8 /swr2_asr/loss_scores.py | |
parent | 14ceeb5ad36beea2f05214aa26260cdd1d86590b (diff) | |
parent | 0d70a19e1fea6eda3f7b16ad0084591613f2de72 (diff) |
Merge pull request #27 from Algo-Boys/refactor_modularize
Refactor modularize
Diffstat (limited to 'swr2_asr/loss_scores.py')
-rw-r--r-- | swr2_asr/loss_scores.py | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/swr2_asr/loss_scores.py b/swr2_asr/loss_scores.py index c49cc15..ef37b0a 100644 --- a/swr2_asr/loss_scores.py +++ b/swr2_asr/loss_scores.py @@ -54,9 +54,7 @@ def _levenshtein_distance(ref, hyp): return distance[len_ref % 2][len_hyp] -def word_errors( - reference: str, hypothesis: str, ignore_case: bool = False, delimiter: str = " " -): +def word_errors(reference: str, hypothesis: str, ignore_case: bool = False, delimiter: str = " "): """Compute the levenshtein distance between reference sequence and hypothesis sequence in word-level. :param reference: The reference sentence. @@ -176,9 +174,7 @@ def cer(reference, hypothesis, ignore_case=False, remove_space=False): :rtype: float :raises ValueError: If the reference length is zero. """ - edit_distance, ref_len = char_errors( - reference, hypothesis, ignore_case, remove_space - ) + edit_distance, ref_len = char_errors(reference, hypothesis, ignore_case, remove_space) if ref_len == 0: raise ValueError("Length of reference should be greater than 0.") |