Commit
·
2efe5be
1
Parent(s):
11538ef
Update sacrebleu_manual.py
Browse files- sacrebleu_manual.py +6 -12
sacrebleu_manual.py
CHANGED
|
@@ -2,13 +2,9 @@
|
|
| 2 |
NOTE: This file implements translation tasks using datasets from WMT conferences,
|
| 3 |
provided by sacrebleu. Traditionally they are evaluated with BLEU scores. TER
|
| 4 |
and CHRF are other options.
|
| 5 |
-
|
| 6 |
-
We defer citations and descriptions of the many translations tasks used
|
| 7 |
-
here to the SacreBLEU repo from which we've obtained the datasets:
|
| 8 |
-
https://github.com/mjpost/sacrebleu/blob/master/sacrebleu/dataset.py
|
| 9 |
-
|
| 10 |
Homepage: https://github.com/mjpost/sacrebleu/blob/master/sacrebleu/dataset.py
|
| 11 |
"""
|
|
|
|
| 12 |
import pycountry
|
| 13 |
from sacrebleu import sacrebleu
|
| 14 |
import datasets
|
|
@@ -28,16 +24,14 @@ _CITATION = """
|
|
| 28 |
}
|
| 29 |
"""
|
| 30 |
|
|
|
|
| 31 |
|
| 32 |
-
class Sacrebleu(datasets.GeneratorBasedBuilder):
|
| 33 |
-
"""The Pile is a 825 GiB diverse, open source language modeling dataset."""
|
| 34 |
-
|
| 35 |
-
VERSION = datasets.Version("0.0.1")
|
| 36 |
|
|
|
|
| 37 |
BUILDER_CONFIGS = [
|
| 38 |
-
datasets.BuilderConfig(name=f"{name}
|
| 39 |
-
for langpair in sacrebleu.get_langpairs_for_testset(name)
|
| 40 |
for name in sacrebleu.get_available_testsets()
|
|
|
|
| 41 |
]
|
| 42 |
|
| 43 |
def _info(self):
|
|
@@ -64,6 +58,6 @@ class Sacrebleu(datasets.GeneratorBasedBuilder):
|
|
| 64 |
|
| 65 |
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
| 66 |
def _generate_examples(self, path):
|
| 67 |
-
with open(path, encoding="utf-8") as f:
|
| 68 |
for key, row in enumerate(f):
|
| 69 |
yield key, json.loads(row)
|
|
|
|
| 2 |
NOTE: This file implements translation tasks using datasets from WMT conferences,
|
| 3 |
provided by sacrebleu. Traditionally they are evaluated with BLEU scores. TER
|
| 4 |
and CHRF are other options.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
Homepage: https://github.com/mjpost/sacrebleu/blob/master/sacrebleu/dataset.py
|
| 6 |
"""
|
| 7 |
+
import os
|
| 8 |
import pycountry
|
| 9 |
from sacrebleu import sacrebleu
|
| 10 |
import datasets
|
|
|
|
| 24 |
}
|
| 25 |
"""
|
| 26 |
|
| 27 |
+
sacrebleu_datasets = sacrebleu.DATASETS
|
| 28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
+
class Sacrebleu(datasets.GeneratorBasedBuilder):
|
| 31 |
BUILDER_CONFIGS = [
|
| 32 |
+
datasets.BuilderConfig(name=f"{name.replace('/', '__')}__{langpair}", version=datasets.Version("1.0.0"), description="")
|
|
|
|
| 33 |
for name in sacrebleu.get_available_testsets()
|
| 34 |
+
for langpair in sacrebleu.get_langpairs_for_testset(name)
|
| 35 |
]
|
| 36 |
|
| 37 |
def _info(self):
|
|
|
|
| 58 |
|
| 59 |
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
| 60 |
def _generate_examples(self, path):
|
| 61 |
+
with open(os.path.join(path.split("__")), encoding="utf-8") as f:
|
| 62 |
for key, row in enumerate(f):
|
| 63 |
yield key, json.loads(row)
|