Spaces:
Running
Running
There is an else statement that is present in the code which is not required so it is removed
#3
by
Yeshwant123
- opened
wer.py
CHANGED
|
@@ -96,11 +96,10 @@ class WER(evaluate.Metric):
|
|
| 96 |
def _compute(self, predictions=None, references=None, concatenate_texts=False):
|
| 97 |
if concatenate_texts:
|
| 98 |
return compute_measures(references, predictions)["wer"]
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
return incorrect / total
|
|
|
|
| 96 |
def _compute(self, predictions=None, references=None, concatenate_texts=False):
|
| 97 |
if concatenate_texts:
|
| 98 |
return compute_measures(references, predictions)["wer"]
|
| 99 |
+
incorrect = 0
|
| 100 |
+
total = 0
|
| 101 |
+
for prediction, reference in zip(predictions, references):
|
| 102 |
+
measures = compute_measures(reference, prediction)
|
| 103 |
+
incorrect += measures["substitutions"] + measures["deletions"] + measures["insertions"]
|
| 104 |
+
total += measures["substitutions"] + measures["deletions"] + measures["hits"]
|
| 105 |
+
return incorrect / total
|
|
|