Commit
·
e5f9604
1
Parent(s):
baa8233
Update sacrebleu_manual.py
Browse files- sacrebleu_manual.py +7 -3
sacrebleu_manual.py
CHANGED
@@ -10,6 +10,7 @@ Homepage: https://github.com/mjpost/sacrebleu/blob/master/sacrebleu/dataset.py
|
|
10 |
from sacrebleu import sacrebleu
|
11 |
import datasets
|
12 |
import os
|
|
|
13 |
|
14 |
|
15 |
_CITATION = """
|
@@ -51,15 +52,18 @@ class SacrebleuManual(datasets.GeneratorBasedBuilder):
|
|
51 |
)
|
52 |
|
53 |
def _split_generators(self, dl_manager):
|
|
|
|
|
|
|
54 |
return [
|
55 |
datasets.SplitGenerator(
|
56 |
name=datasets.Split.TEST,
|
57 |
-
gen_kwargs={},
|
58 |
)
|
59 |
]
|
60 |
|
61 |
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
62 |
-
def _generate_examples(self):
|
63 |
-
with open(
|
64 |
for key, row in enumerate(f):
|
65 |
yield key, json.loads(row)
|
|
|
10 |
from sacrebleu import sacrebleu
|
11 |
import datasets
|
12 |
import os
|
13 |
+
import json
|
14 |
|
15 |
|
16 |
_CITATION = """
|
|
|
52 |
)
|
53 |
|
54 |
def _split_generators(self, dl_manager):
|
55 |
+
downloaded_files = dl_manager.download(f"{os.path.join(*self.config.name.split('_'))}.jsonl")
|
56 |
+
print(downloaded_files)
|
57 |
+
|
58 |
return [
|
59 |
datasets.SplitGenerator(
|
60 |
name=datasets.Split.TEST,
|
61 |
+
gen_kwargs={"path": downloaded_files},
|
62 |
)
|
63 |
]
|
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)
|