Spaces:
Running
Running
Update Space (evaluate main: dfdd0cc0)
Browse files- wiki_split.py +17 -6
wiki_split.py
CHANGED
@@ -327,12 +327,20 @@ class WikiSplit(evaluate.EvaluationModule):
|
|
327 |
description=_DESCRIPTION,
|
328 |
citation=_CITATION,
|
329 |
inputs_description=_KWARGS_DESCRIPTION,
|
330 |
-
features=
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
336 |
codebase_urls=[
|
337 |
"https://github.com/huggingface/transformers/blob/master/src/transformers/data/metrics/squad_metrics.py",
|
338 |
"https://github.com/cocoxu/simplification/blob/master/SARI.py",
|
@@ -348,6 +356,9 @@ class WikiSplit(evaluate.EvaluationModule):
|
|
348 |
)
|
349 |
|
350 |
def _compute(self, sources, predictions, references):
|
|
|
|
|
|
|
351 |
result = {}
|
352 |
result.update({"sari": compute_sari(sources=sources, predictions=predictions, references=references)})
|
353 |
result.update({"sacrebleu": compute_sacrebleu(predictions=predictions, references=references)})
|
|
|
327 |
description=_DESCRIPTION,
|
328 |
citation=_CITATION,
|
329 |
inputs_description=_KWARGS_DESCRIPTION,
|
330 |
+
features=[
|
331 |
+
datasets.Features(
|
332 |
+
{
|
333 |
+
"predictions": datasets.Value("string", id="sequence"),
|
334 |
+
"references": datasets.Sequence(datasets.Value("string", id="sequence"), id="references"),
|
335 |
+
}
|
336 |
+
),
|
337 |
+
datasets.Features(
|
338 |
+
{
|
339 |
+
"predictions": datasets.Value("string", id="sequence"),
|
340 |
+
"references": datasets.Value("string", id="sequence"),
|
341 |
+
}
|
342 |
+
),
|
343 |
+
],
|
344 |
codebase_urls=[
|
345 |
"https://github.com/huggingface/transformers/blob/master/src/transformers/data/metrics/squad_metrics.py",
|
346 |
"https://github.com/cocoxu/simplification/blob/master/SARI.py",
|
|
|
356 |
)
|
357 |
|
358 |
def _compute(self, sources, predictions, references):
|
359 |
+
# if only one reference is provided make sure we still use list of lists
|
360 |
+
if isinstance(references[0], str):
|
361 |
+
references = [[ref] for ref in references]
|
362 |
result = {}
|
363 |
result.update({"sari": compute_sari(sources=sources, predictions=predictions, references=references)})
|
364 |
result.update({"sacrebleu": compute_sacrebleu(predictions=predictions, references=references)})
|