Datasets:

Modalities:
Text
Formats:
parquet
Languages:
English
Libraries:
Datasets
pandas
License:
sileod commited on
Commit
7987d7a
1 Parent(s): 4dd3744

Update disrpt.py

Browse files
Files changed (1) hide show
  1. disrpt.py +7 -9
disrpt.py CHANGED
@@ -157,16 +157,14 @@ class Dataset(datasets.GeneratorBasedBuilder):
157
  urls={k:v for (k,v) in _URLs.items() if cfg_name in k and requests.get(v).status_code!=404}
158
  data_file = dl_manager.download(urls)
159
  self.files = {**self.files, **data_file}
160
- train_key = data_dir+'-train'
161
- print("datafile:",data_file, self.config.data_dir)
162
- if train_key in data_file:
163
- train=[datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": data_file[train_key]})]
164
- else:
165
- train=[]
166
- return train+[
167
- datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": data_file[data_dir+'-dev.'+type]}),
168
- datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": data_file[data_dir+'-test.'+type]}),
169
  ]
 
170
 
171
  def _info(self): return datasets.DatasetInfo(
172
  citation=key_to_entry.get(datasets_and_citations.get(remove_type(self.config.name)),None),
 
157
  urls={k:v for (k,v) in _URLs.items() if cfg_name in k and requests.get(v).status_code!=404}
158
  data_file = dl_manager.download(urls)
159
  self.files = {**self.files, **data_file}
160
+
161
+ splits_dict = {datasets.Split.TRAIN: 'train', datasets.Split.VALIDATION: 'dev', datasets.Split.TEST: 'test'}
162
+ split_generators = [
163
+ datasets.SplitGenerator(name=split, gen_kwargs={"filepath": data_file[f"{data_dir}-{key}.{type}"]})
164
+ for split, key in splits_dict.items()
165
+ if f"{data_dir}-{key}" in data_file
 
 
 
166
  ]
167
+ return split_generators
168
 
169
  def _info(self): return datasets.DatasetInfo(
170
  citation=key_to_entry.get(datasets_and_citations.get(remove_type(self.config.name)),None),