Commit
·
c1cfd44
1
Parent(s):
d0542df
Controlled-Text-Reduction-dataset.py
CHANGED
|
@@ -128,7 +128,7 @@
|
|
| 128 |
# ]
|
| 129 |
|
| 130 |
# DEFAULT_CONFIG_NAME = (
|
| 131 |
-
# "
|
| 132 |
# )
|
| 133 |
|
| 134 |
# def _info(self):
|
|
@@ -324,20 +324,28 @@ COLUMNS = ["doc_text", "summary_text", "highlight_spans"]
|
|
| 324 |
|
| 325 |
|
| 326 |
# _URLs = {
|
| 327 |
-
# "
|
| 328 |
-
#
|
| 329 |
-
#
|
| 330 |
-
#
|
| 331 |
-
#
|
| 332 |
-
# "
|
|
|
|
|
|
|
|
|
|
|
|
|
| 333 |
# }
|
| 334 |
|
| 335 |
-
|
| 336 |
-
|
| 337 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 338 |
|
| 339 |
|
| 340 |
-
# TODO: Name of the dataset usually match the script name with CamelCase instead of snake_case
|
| 341 |
class ControlledTectReduction(datasets.GeneratorBasedBuilder):
|
| 342 |
"""Controlled Text Reduction: dataset for the Controlled Text Reduction task ().
|
| 343 |
Each data point consists of a document, a summary, and a list of spans of the document that are the pre-selected content whose summary is the summary"""
|
|
@@ -345,14 +353,25 @@ class ControlledTectReduction(datasets.GeneratorBasedBuilder):
|
|
| 345 |
|
| 346 |
VERSION = datasets.Version("1.0.0")
|
| 347 |
|
|
|
|
|
|
|
| 348 |
BUILDER_CONFIGS = [
|
| 349 |
-
|
| 350 |
-
name="
|
|
|
|
|
|
|
|
|
|
| 351 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 352 |
]
|
| 353 |
|
| 354 |
DEFAULT_CONFIG_NAME = (
|
| 355 |
-
"
|
| 356 |
)
|
| 357 |
|
| 358 |
def _info(self):
|
|
|
|
| 128 |
# ]
|
| 129 |
|
| 130 |
# DEFAULT_CONFIG_NAME = (
|
| 131 |
+
# "DUC-2001-2002" # It's not mandatory to have a default configuration. Just use one if it make sense.
|
| 132 |
# )
|
| 133 |
|
| 134 |
# def _info(self):
|
|
|
|
| 324 |
|
| 325 |
|
| 326 |
# _URLs = {
|
| 327 |
+
# "DUC-2001-2002": {
|
| 328 |
+
# "dev": "https://github.com/lovodkin93/Controlled_Text_Reduction/tree/main/data/dev_DUC-2001-2002.csv",
|
| 329 |
+
# "test": "https://github.com/lovodkin93/Controlled_Text_Reduction/tree/main/data/test_DUC-2001-2002.csv",
|
| 330 |
+
# "train": "https://github.com/lovodkin93/Controlled_Text_Reduction/tree/main/data/train_DUC-2001-2002.csv"
|
| 331 |
+
# },
|
| 332 |
+
# "CNN-DM": {
|
| 333 |
+
# "train": "https://github.com/lovodkin93/Controlled_Text_Reduction/tree/main/data/train_CNNDM.csv",
|
| 334 |
+
# "dev": "https://github.com/lovodkin93/Controlled_Text_Reduction/tree/main/data/dev_DUC-2001-2002.csv",
|
| 335 |
+
# "test": "https://github.com/lovodkin93/Controlled_Text_Reduction/tree/main/data/test_DUC-2001-2002.csv",
|
| 336 |
+
# },
|
| 337 |
# }
|
| 338 |
|
| 339 |
+
|
| 340 |
+
@dataclass
|
| 341 |
+
class ControlledTextReductionConfig(datasets.BuilderConfig):
|
| 342 |
+
""" Allow the loader to re-distribute the original dev and test splits between train, dev and test. """
|
| 343 |
+
data_source: str = "DUC-2001-2002" # "DUC-2001-2002" or "CNN-DM"
|
| 344 |
+
|
| 345 |
+
|
| 346 |
+
|
| 347 |
|
| 348 |
|
|
|
|
| 349 |
class ControlledTectReduction(datasets.GeneratorBasedBuilder):
|
| 350 |
"""Controlled Text Reduction: dataset for the Controlled Text Reduction task ().
|
| 351 |
Each data point consists of a document, a summary, and a list of spans of the document that are the pre-selected content whose summary is the summary"""
|
|
|
|
| 353 |
|
| 354 |
VERSION = datasets.Version("1.0.0")
|
| 355 |
|
| 356 |
+
BUILDER_CONFIG_CLASS = ControlledTextReductionConfig
|
| 357 |
+
|
| 358 |
BUILDER_CONFIGS = [
|
| 359 |
+
ControlledTextReductionConfig(
|
| 360 |
+
name="DUC-2001-2002",
|
| 361 |
+
version=VERSION,
|
| 362 |
+
description="This provides the Controlled Text Reduction dataset extracted from the DUC 2001-2002 Single Document Summarization benchmark",
|
| 363 |
+
data_source="DUC-2001-2002"
|
| 364 |
),
|
| 365 |
+
ControlledTextReductionConfig(
|
| 366 |
+
name="CNN-DM",
|
| 367 |
+
version=VERSION,
|
| 368 |
+
description="This provides the Controlled Text Reduction dataset extracted from the CNN-DM dataset (the train split)",
|
| 369 |
+
data_source="CNN-DM"
|
| 370 |
+
)
|
| 371 |
]
|
| 372 |
|
| 373 |
DEFAULT_CONFIG_NAME = (
|
| 374 |
+
"DUC-2001-2002" # It's not mandatory to have a default configuration. Just use one if it make sense.
|
| 375 |
)
|
| 376 |
|
| 377 |
def _info(self):
|