Spaces:
Sleeping
Sleeping
Update wer.py
Browse files
wer.py
CHANGED
@@ -18,40 +18,6 @@ from jiwer import compute_measures
|
|
18 |
|
19 |
import evaluate
|
20 |
|
21 |
-
|
22 |
-
_CITATION = """\
|
23 |
-
@inproceedings{inproceedings,
|
24 |
-
author = {Morris, Andrew and Maier, Viktoria and Green, Phil},
|
25 |
-
year = {2004},
|
26 |
-
month = {01},
|
27 |
-
pages = {},
|
28 |
-
title = {From WER and RIL to MER and WIL: improved evaluation measures for connected speech recognition.}
|
29 |
-
}
|
30 |
-
"""
|
31 |
-
|
32 |
-
_DESCRIPTION = """\
|
33 |
-
Word error rate (WER) is a common metric of the performance of an automatic speech recognition system.
|
34 |
-
|
35 |
-
The general difficulty of measuring performance lies in the fact that the recognized word sequence can have a different length from the reference word sequence (supposedly the correct one). The WER is derived from the Levenshtein distance, working at the word level instead of the phoneme level. The WER is a valuable tool for comparing different systems as well as for evaluating improvements within one system. This kind of measurement, however, provides no details on the nature of translation errors and further work is therefore required to identify the main source(s) of error and to focus any research effort.
|
36 |
-
|
37 |
-
This problem is solved by first aligning the recognized word sequence with the reference (spoken) word sequence using dynamic string alignment. Examination of this issue is seen through a theory called the power law that states the correlation between perplexity and word error rate.
|
38 |
-
|
39 |
-
Word error rate can then be computed as:
|
40 |
-
|
41 |
-
WER = (S + D + I) / N = (S + D + I) / (S + D + C)
|
42 |
-
|
43 |
-
where
|
44 |
-
|
45 |
-
S is the number of substitutions,
|
46 |
-
D is the number of deletions,
|
47 |
-
I is the number of insertions,
|
48 |
-
C is the number of correct words,
|
49 |
-
N is the number of words in the reference (N=S+D+C).
|
50 |
-
|
51 |
-
This value indicates the average number of errors per reference word. The lower the value, the better the
|
52 |
-
performance of the ASR system with a WER of 0 being a perfect score.
|
53 |
-
"""
|
54 |
-
|
55 |
_KWARGS_DESCRIPTION = """
|
56 |
Compute WER score of transcribed segments against references.
|
57 |
|
@@ -78,9 +44,6 @@ Examples:
|
|
78 |
class WER(evaluate.Metric):
|
79 |
def _info(self):
|
80 |
return evaluate.MetricInfo(
|
81 |
-
description=_DESCRIPTION,
|
82 |
-
citation=_CITATION,
|
83 |
-
inputs_description=_KWARGS_DESCRIPTION,
|
84 |
features=datasets.Features(
|
85 |
{
|
86 |
"predictions": datasets.Value("string", id="sequence"),
|
|
|
18 |
|
19 |
import evaluate
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
_KWARGS_DESCRIPTION = """
|
22 |
Compute WER score of transcribed segments against references.
|
23 |
|
|
|
44 |
class WER(evaluate.Metric):
|
45 |
def _info(self):
|
46 |
return evaluate.MetricInfo(
|
|
|
|
|
|
|
47 |
features=datasets.Features(
|
48 |
{
|
49 |
"predictions": datasets.Value("string", id="sequence"),
|