Felix commited on
Commit
285c6bd
1 Parent(s): c7a5837

add _split_generators method

Browse files
Files changed (1) hide show
  1. superlim-2.py +46 -1
superlim-2.py CHANGED
@@ -269,4 +269,49 @@ class SuperLim(datasets.GeneratorBasedBuilder):
269
  license=_LICENSE,
270
  # Citation for the dataset
271
  citation=_CITATION,
272
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
269
  license=_LICENSE,
270
  # Citation for the dataset
271
  citation=_CITATION,
272
+ )
273
+
274
+ def _split_generators(self, dl_manager):
275
+ if self.config.name in ("absabank", "dalaj", "swefaq", "swewic"):
276
+ data_dir_test = dl_manager.download_and_extract(os.path.join(_URL,_TASKS[self.config.name],"test.csv"))
277
+ data_dir_train = dl_manager.download_and_extract(os.path.join(_URL,_TASKS[self.config.name],"train.csv"))
278
+ data_dir_dev = dl_manager.download_and_extract(os.path.join(_URL,_TASKS[self.config.name],"dev.csv"))
279
+
280
+ return [
281
+ datasets.SplitGenerator(
282
+ name=datasets.Split.TRAIN,
283
+ # These kwargs will be passed to _generate_examples
284
+ gen_kwargs={
285
+ "filepath": data_dir_train,
286
+ "split": "train",
287
+ },
288
+ ),
289
+ datasets.SplitGenerator(
290
+ name=datasets.Split.TEST,
291
+ # These kwargs will be passed to _generate_examples
292
+ gen_kwargs={
293
+ "filepath": data_dir_test,
294
+ "split": "test"
295
+ },
296
+ ),
297
+ datasets.SplitGenerator(
298
+ name=datasets.Split.VALIDATION,
299
+ # These kwargs will be passed to _generate_examples
300
+ gen_kwargs={
301
+ "filepath": data_dir_dev,
302
+ "split": "dev",
303
+ },
304
+ ),
305
+ ]
306
+ else:
307
+ data_dir_test = dl_manager.download_and_extract(os.path.join(_URL, _TASKS[self.config.name], "test.csv"))
308
+ return [
309
+ datasets.SplitGenerator(
310
+ name=datasets.Split.TEST,
311
+ # These kwargs will be passed to _generate_examples
312
+ gen_kwargs={
313
+ "filepath": data_dir_test,
314
+ "split": "test"
315
+ },
316
+ ),
317
+ ]