Datasets:
xiaojuan0920
commited on
Commit
•
68b61d5
1
Parent(s):
74c2c9e
Update CSKG.py
Browse files
CSKG.py
CHANGED
@@ -165,12 +165,13 @@ class CSKG(datasets.GeneratorBasedBuilder):
|
|
165 |
def _generate_examples(self, filepath, split):
|
166 |
# TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
|
167 |
# The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
|
168 |
-
with open(filepath,
|
169 |
-
for
|
170 |
-
row = row.split(b"\t")
|
171 |
if self.config.name == "cskg":
|
|
|
|
|
172 |
# Yields examples as (key, example) tuples
|
173 |
-
yield
|
174 |
# "sentence": data["sentence"],
|
175 |
# "option1": data["option1"],
|
176 |
# "answer": "" if split == "test" else data["answer"],
|
|
|
165 |
def _generate_examples(self, filepath, split):
|
166 |
# TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
|
167 |
# The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
|
168 |
+
with open(filepath, 'rb') as f:
|
169 |
+
for id_, row in enumerate(f):
|
|
|
170 |
if self.config.name == "cskg":
|
171 |
+
row = row.split(b"\t")
|
172 |
+
|
173 |
# Yields examples as (key, example) tuples
|
174 |
+
yield id_, {
|
175 |
# "sentence": data["sentence"],
|
176 |
# "option1": data["option1"],
|
177 |
# "answer": "" if split == "test" else data["answer"],
|