Datasets:
update
Browse files- SuperLim.py +10 -12
SuperLim.py
CHANGED
@@ -170,15 +170,14 @@ class SuperLim(datasets.GeneratorBasedBuilder):
|
|
170 |
|
171 |
DEFAULT_CONFIG_NAME = "swewic" # It's not mandatory to have a default configuration. Just use one if it make sense.
|
172 |
|
173 |
-
|
174 |
def _info(self):
|
175 |
# TODO: This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset
|
176 |
-
if self.config.name == "
|
177 |
features = datasets.Features(
|
178 |
{
|
179 |
-
"sentence": datasets.Value("string"),
|
180 |
-
"
|
181 |
-
"answer": datasets.Value("string")
|
182 |
# These are the features of your dataset like images, labels ...
|
183 |
}
|
184 |
)
|
@@ -206,7 +205,7 @@ class SuperLim(datasets.GeneratorBasedBuilder):
|
|
206 |
# Citation for the dataset
|
207 |
citation=_CITATION,
|
208 |
)
|
209 |
-
|
210 |
def _split_generators(self, dl_manager):
|
211 |
# TODO: This method is tasked with downloading/extracting the data and defining the splits depending on the configuration
|
212 |
# If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
|
@@ -243,7 +242,7 @@ class SuperLim(datasets.GeneratorBasedBuilder):
|
|
243 |
),
|
244 |
]
|
245 |
|
246 |
-
|
247 |
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
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.
|
@@ -251,12 +250,11 @@ class SuperLim(datasets.GeneratorBasedBuilder):
|
|
251 |
with open(filepath, encoding="utf-8") as f:
|
252 |
for key, row in enumerate(f):
|
253 |
data = json.loads(row)
|
254 |
-
if self.config.name == "
|
255 |
# Yields examples as (key, example) tuples
|
256 |
yield key, {
|
257 |
-
"sentence": data["sentence"],
|
258 |
-
"
|
259 |
-
"answer": "" if split == "test" else data["answer"],
|
260 |
}
|
261 |
else:
|
262 |
yield key, {
|
@@ -264,4 +262,4 @@ class SuperLim(datasets.GeneratorBasedBuilder):
|
|
264 |
"option2": data["option2"],
|
265 |
"second_domain_answer": "" if split == "test" else data["second_domain_answer"],
|
266 |
}
|
267 |
-
|
|
|
170 |
|
171 |
DEFAULT_CONFIG_NAME = "swewic" # It's not mandatory to have a default configuration. Just use one if it make sense.
|
172 |
|
173 |
+
|
174 |
def _info(self):
|
175 |
# TODO: This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset
|
176 |
+
if self.config.name == "dalaj": # This is the name of the configuration selected in BUILDER_CONFIGS above
|
177 |
features = datasets.Features(
|
178 |
{
|
179 |
+
"original sentence": datasets.Value("string"),
|
180 |
+
"corrected sentence": datasets.Value("string")
|
|
|
181 |
# These are the features of your dataset like images, labels ...
|
182 |
}
|
183 |
)
|
|
|
205 |
# Citation for the dataset
|
206 |
citation=_CITATION,
|
207 |
)
|
208 |
+
|
209 |
def _split_generators(self, dl_manager):
|
210 |
# TODO: This method is tasked with downloading/extracting the data and defining the splits depending on the configuration
|
211 |
# If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
|
|
|
242 |
),
|
243 |
]
|
244 |
|
245 |
+
|
246 |
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
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.
|
|
|
250 |
with open(filepath, encoding="utf-8") as f:
|
251 |
for key, row in enumerate(f):
|
252 |
data = json.loads(row)
|
253 |
+
if self.config.name == "dalaj":
|
254 |
# Yields examples as (key, example) tuples
|
255 |
yield key, {
|
256 |
+
"original sentence": data["original sentence"],
|
257 |
+
"correct sentence": data["corrected sentence"],
|
|
|
258 |
}
|
259 |
else:
|
260 |
yield key, {
|
|
|
262 |
"option2": data["option2"],
|
263 |
"second_domain_answer": "" if split == "test" else data["second_domain_answer"],
|
264 |
}
|
265 |
+
|