Datasets:

Modalities:
Text
ArXiv:
Libraries:
Datasets
lovodkin93 commited on
Commit
d0542df
1 Parent(s): c99e5ac
Controlled-Text-Reduction-dataset.py CHANGED
@@ -392,31 +392,31 @@ class ControlledTectReduction(datasets.GeneratorBasedBuilder):
392
  name=datasets.Split.TRAIN,
393
  # These kwargs will be passed to _generate_examples
394
  gen_kwargs={
395
- "filepaths": [corpora["train_DUC-2001-2002"]],
396
  },
397
  ),
398
  datasets.SplitGenerator(
399
  name=datasets.Split.VALIDATION,
400
  # These kwargs will be passed to _generate_examples
401
  gen_kwargs={
402
- "filepaths": [corpora["dev_DUC-2001-2002"]],
403
  },
404
  ),
405
  datasets.SplitGenerator(
406
  name=datasets.Split.TEST,
407
  # These kwargs will be passed to _generate_examples
408
  gen_kwargs={
409
- "filepaths": [corpora["test_DUC-2001-2002"]],
410
  },
411
  ),
412
  ]
413
 
414
- def _generate_examples(self, filepaths: List[str]):
415
 
416
  """ Yields Controlled Text Reduction examples from a csv file. Each instance contains the document, the summary and the pre-selected spans."""
417
 
418
  # merge annotations from sections
419
- df = pd.concat([pd.read_csv(fn) for fn in filepaths])
420
  for counter, dic in enumerate(df.to_dict('records')):
421
  columns_to_load_into_object = ["doc_text", "summary_text", "highlight_spans"]
422
  # for key in columns_to_load_into_object:
 
392
  name=datasets.Split.TRAIN,
393
  # These kwargs will be passed to _generate_examples
394
  gen_kwargs={
395
+ "filepath": corpora["train_DUC-2001-2002"],
396
  },
397
  ),
398
  datasets.SplitGenerator(
399
  name=datasets.Split.VALIDATION,
400
  # These kwargs will be passed to _generate_examples
401
  gen_kwargs={
402
+ "filepath": corpora["dev_DUC-2001-2002"],
403
  },
404
  ),
405
  datasets.SplitGenerator(
406
  name=datasets.Split.TEST,
407
  # These kwargs will be passed to _generate_examples
408
  gen_kwargs={
409
+ "filepath": corpora["test_DUC-2001-2002"],
410
  },
411
  ),
412
  ]
413
 
414
+ def _generate_examples(self, filepath: List[str]):
415
 
416
  """ Yields Controlled Text Reduction examples from a csv file. Each instance contains the document, the summary and the pre-selected spans."""
417
 
418
  # merge annotations from sections
419
+ df = pd.read_csv(filepath)
420
  for counter, dic in enumerate(df.to_dict('records')):
421
  columns_to_load_into_object = ["doc_text", "summary_text", "highlight_spans"]
422
  # for key in columns_to_load_into_object: