Spaces:
Running
Running
Update Space (evaluate main: dfdd0cc0)
Browse files
ter.py
CHANGED
@@ -163,12 +163,20 @@ class Ter(evaluate.EvaluationModule):
|
|
163 |
citation=_CITATION,
|
164 |
homepage="http://www.cs.umd.edu/~snover/tercom/",
|
165 |
inputs_description=_KWARGS_DESCRIPTION,
|
166 |
-
features=
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
codebase_urls=["https://github.com/mjpost/sacreBLEU#ter"],
|
173 |
reference_urls=[
|
174 |
"https://github.com/jhclark/tercom",
|
@@ -184,6 +192,10 @@ class Ter(evaluate.EvaluationModule):
|
|
184 |
support_zh_ja_chars: bool = False,
|
185 |
case_sensitive: bool = False,
|
186 |
):
|
|
|
|
|
|
|
|
|
187 |
references_per_prediction = len(references[0])
|
188 |
if any(len(refs) != references_per_prediction for refs in references):
|
189 |
raise ValueError("Sacrebleu requires the same number of references for each prediction")
|
|
|
163 |
citation=_CITATION,
|
164 |
homepage="http://www.cs.umd.edu/~snover/tercom/",
|
165 |
inputs_description=_KWARGS_DESCRIPTION,
|
166 |
+
features=[
|
167 |
+
datasets.Features(
|
168 |
+
{
|
169 |
+
"predictions": datasets.Value("string", id="sequence"),
|
170 |
+
"references": datasets.Sequence(datasets.Value("string", id="sequence"), id="references"),
|
171 |
+
}
|
172 |
+
),
|
173 |
+
datasets.Features(
|
174 |
+
{
|
175 |
+
"predictions": datasets.Value("string", id="sequence"),
|
176 |
+
"references": datasets.Value("string", id="sequence"),
|
177 |
+
}
|
178 |
+
),
|
179 |
+
],
|
180 |
codebase_urls=["https://github.com/mjpost/sacreBLEU#ter"],
|
181 |
reference_urls=[
|
182 |
"https://github.com/jhclark/tercom",
|
|
|
192 |
support_zh_ja_chars: bool = False,
|
193 |
case_sensitive: bool = False,
|
194 |
):
|
195 |
+
# if only one reference is provided make sure we still use list of lists
|
196 |
+
if isinstance(references[0], str):
|
197 |
+
references = [[ref] for ref in references]
|
198 |
+
|
199 |
references_per_prediction = len(references[0])
|
200 |
if any(len(refs) != references_per_prediction for refs in references):
|
201 |
raise ValueError("Sacrebleu requires the same number of references for each prediction")
|