Datasets:
Tasks:
Table to Text
Modalities:
Text
Languages:
English
Size:
100K - 1M
ArXiv:
Tags:
data-to-text
License:
Abinaya Mahendiran
commited on
Commit
·
7e08b55
1
Parent(s):
89635c5
Fixed indentation in data loader script
Browse files
totto.py
CHANGED
@@ -119,19 +119,19 @@ class Mlsum(datasets.GeneratorBasedBuilder):
|
|
119 |
def _generate_examples(self, filepath, split, filepaths=None, lang=None):
|
120 |
"""Yields examples."""
|
121 |
if "challenge" in split:
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
id_ = -1
|
136 |
i = -1
|
137 |
for json_str in json_list:
|
|
|
119 |
def _generate_examples(self, filepath, split, filepaths=None, lang=None):
|
120 |
"""Yields examples."""
|
121 |
if "challenge" in split:
|
122 |
+
exples = json.load(open(filepath, encoding="utf-8"))
|
123 |
+
if isinstance(exples, dict):
|
124 |
+
assert len(exples) == 1, "multiple entries found"
|
125 |
+
exples = list(exples.values())[0]
|
126 |
+
for id_, exple in enumerate(exples):
|
127 |
+
if len(exple) == 0:
|
128 |
+
continue
|
129 |
+
exple["gem_parent_id"] = exple["gem_id"]
|
130 |
+
exple["gem_id"] = f"{self.config.name}-{split}-{id_}"
|
131 |
+
yield id_, exple
|
132 |
+
else:
|
133 |
+
with open(filepath, "r", encoding="utf-8") as json_file:
|
134 |
+
json_list = list(json_file)
|
135 |
id_ = -1
|
136 |
i = -1
|
137 |
for json_str in json_list:
|