Datasets:
update
Browse files- SuperLim.py +16 -16
SuperLim.py
CHANGED
@@ -19,6 +19,7 @@
|
|
19 |
import json
|
20 |
import os
|
21 |
import datasets
|
|
|
22 |
|
23 |
_CITATION = """\
|
24 |
"""
|
@@ -247,19 +248,18 @@ class SuperLim(datasets.GeneratorBasedBuilder):
|
|
247 |
def _generate_examples(self, filepath, split):
|
248 |
# TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
|
249 |
# The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
|
|
19 |
import json
|
20 |
import os
|
21 |
import datasets
|
22 |
+
import pandas as pd
|
23 |
|
24 |
_CITATION = """\
|
25 |
"""
|
|
|
248 |
def _generate_examples(self, filepath, split):
|
249 |
# TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
|
250 |
# The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
|
251 |
+
df = pd.read_csv(filepath)
|
252 |
+
for key, row in df.iterrows():
|
253 |
+
if self.config.name == "dalaj":
|
254 |
+
# Yields examples as (key, example) tuples
|
255 |
+
yield key, {
|
256 |
+
"original sentence": row["original sentence"],
|
257 |
+
"corrected sentence": row["corrected sentence"],
|
258 |
+
}
|
259 |
+
else:
|
260 |
+
yield key, {
|
261 |
+
"sentence": data["sentence"],
|
262 |
+
"option2": data["option2"],
|
263 |
+
"second_domain_answer": "" if split == "test" else data["second_domain_answer"],
|
264 |
+
}
|
265 |
+
|
|