Update msmarco-passage-corpus.py
Browse files
msmarco-passage-corpus.py
CHANGED
@@ -62,16 +62,16 @@ class MsMarcoPassage(datasets.GeneratorBasedBuilder):
|
|
62 |
datasets.SplitGenerator(
|
63 |
name=split,
|
64 |
gen_kwargs={
|
65 |
-
"
|
66 |
},
|
67 |
) for split in downloaded_files
|
68 |
]
|
69 |
return splits
|
70 |
|
71 |
-
def _generate_examples(self,
|
72 |
"""Yields examples."""
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
|
|
62 |
datasets.SplitGenerator(
|
63 |
name=split,
|
64 |
gen_kwargs={
|
65 |
+
"files": [downloaded_files[split]] if isinstance(downloaded_files[split], str) else downloaded_files[split],
|
66 |
},
|
67 |
) for split in downloaded_files
|
68 |
]
|
69 |
return splits
|
70 |
|
71 |
+
def _generate_examples(self, files):
|
72 |
"""Yields examples."""
|
73 |
+
for filepath in files:
|
74 |
+
with open(filepath, encoding="utf-8") as f:
|
75 |
+
for i, text in enumerate(f):
|
76 |
+
text = json.loads(text)
|
77 |
+
yield i, text
|