Datasets:

Modalities:
Text
ArXiv:
Libraries:
Datasets
lovodkin93 commited on
Commit
0beca5d
1 Parent(s): 0e55346

updated the script

Browse files
Controlled-Text-Reduction-dataset.py CHANGED
@@ -94,7 +94,10 @@ _URLs = {
94
  }
95
 
96
 
97
-
 
 
 
98
 
99
 
100
 
@@ -105,16 +108,20 @@ class ControlledTextReduction(datasets.GeneratorBasedBuilder):
105
 
106
  VERSION = datasets.Version("1.0.0")
107
 
 
 
108
  BUILDER_CONFIGS = [
109
- datasets.BuilderConfig(
110
  name="DUC-2001-2002",
111
  version=VERSION,
112
- description="This provides the Controlled Text Reduction dataset extracted from the DUC 2001-2002 Single Document Summarization benchmark"
 
113
  ),
114
- datasets.BuilderConfig(
115
  name="CNN-DM",
116
  version=VERSION,
117
- description="This provides the Controlled Text Reduction dataset extracted from the CNN-DM dataset (the train split)"
 
118
  )
119
  ]
120
 
@@ -150,12 +157,12 @@ class ControlledTextReduction(datasets.GeneratorBasedBuilder):
150
  def _split_generators(self, dl_manager: datasets.utils.download_manager.DownloadManager):
151
  """Returns SplitGenerators."""
152
 
153
- URLs = _URLs[self.config.name]
154
  # Download and prepare all files - keep same structure as URLs
155
  corpora = {section: Path(dl_manager.download_and_extract(URLs[section]))
156
  for section in URLs}
157
 
158
- if self.config.name=="CNN-DM":
159
  return [
160
  datasets.SplitGenerator(
161
  name=datasets.Split.TRAIN,
 
94
  }
95
 
96
 
97
+ @dataclass
98
+ class ControlledTextReductionConfig(datasets.BuilderConfig):
99
+ """ Allow the loader to re-distribute the original dev and test splits between train, dev and test. """
100
+ data_source: str = "DUC-2001-2002" # "DUC-2001-2002" or "CNN-DM"
101
 
102
 
103
 
 
108
 
109
  VERSION = datasets.Version("1.0.0")
110
 
111
+ BUILDER_CONFIG_CLASS = ControlledTextReductionConfig
112
+
113
  BUILDER_CONFIGS = [
114
+ ControlledTextReductionConfig(
115
  name="DUC-2001-2002",
116
  version=VERSION,
117
+ description="This provides the Controlled Text Reduction dataset extracted from the DUC 2001-2002 Single Document Summarization benchmark",
118
+ data_source="DUC-2001-2002"
119
  ),
120
+ ControlledTextReductionConfig(
121
  name="CNN-DM",
122
  version=VERSION,
123
+ description="This provides the Controlled Text Reduction dataset extracted from the CNN-DM dataset (the train split)",
124
+ data_source="CNN-DM"
125
  )
126
  ]
127
 
 
157
  def _split_generators(self, dl_manager: datasets.utils.download_manager.DownloadManager):
158
  """Returns SplitGenerators."""
159
 
160
+ URLs = _URLs[self.config.data_source]
161
  # Download and prepare all files - keep same structure as URLs
162
  corpora = {section: Path(dl_manager.download_and_extract(URLs[section]))
163
  for section in URLs}
164
 
165
+ if self.config.data_source=="CNN-DM":
166
  return [
167
  datasets.SplitGenerator(
168
  name=datasets.Split.TRAIN,