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