AlhitawiMohammed22
commited on
Commit
β’
828a06e
1
Parent(s):
7fd981a
remove wer
Browse files- eval_cer.py +1 -32
eval_cer.py
CHANGED
@@ -140,35 +140,4 @@ class CER(evaluate.Metric):
|
|
140 |
incorrect += measures["substitutions"] + measures["deletions"] + measures["insertions"]
|
141 |
total += measures["substitutions"] + measures["deletions"] + measures["hits"]
|
142 |
|
143 |
-
return incorrect / total
|
144 |
-
|
145 |
-
@evaluate.utils.file_utils.add_start_docstrings(_DESCRIPTION, _KWARGS_DESCRIPTION)
|
146 |
-
class WER(evaluate.Metric):
|
147 |
-
def _info(self):
|
148 |
-
return evaluate.MetricInfo(
|
149 |
-
description=_DESCRIPTION,
|
150 |
-
citation=_CITATION,
|
151 |
-
inputs_description=_KWARGS_DESCRIPTION,
|
152 |
-
features=datasets.Features(
|
153 |
-
{
|
154 |
-
"predictions": datasets.Value("string", id="sequence"),
|
155 |
-
"references": datasets.Value("string", id="sequence"),
|
156 |
-
}
|
157 |
-
),
|
158 |
-
codebase_urls=["https://github.com/jitsi/jiwer/"],
|
159 |
-
reference_urls=[
|
160 |
-
"https://en.wikipedia.org/wiki/Word_error_rate",
|
161 |
-
],
|
162 |
-
)
|
163 |
-
|
164 |
-
def _compute(self, predictions=None, references=None, concatenate_texts=False):
|
165 |
-
if concatenate_texts:
|
166 |
-
return compute_measures(references, predictions)["wer"]
|
167 |
-
else:
|
168 |
-
incorrect = 0
|
169 |
-
total = 0
|
170 |
-
for prediction, reference in zip(predictions, references):
|
171 |
-
measures = compute_measures(reference, prediction)
|
172 |
-
incorrect += measures["substitutions"] + measures["deletions"] + measures["insertions"]
|
173 |
-
total += measures["substitutions"] + measures["deletions"] + measures["hits"]
|
174 |
-
return incorrect / total
|
|
|
140 |
incorrect += measures["substitutions"] + measures["deletions"] + measures["insertions"]
|
141 |
total += measures["substitutions"] + measures["deletions"] + measures["hits"]
|
142 |
|
143 |
+
return incorrect / total
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|