Datasets:

Modalities:
Text
Formats:
parquet
Languages:
English
Libraries:
Datasets
pandas
License:
sileod commited on
Commit
2cf440c
1 Parent(s): 8eac489

Update disrpt.py

Browse files
Files changed (1) hide show
  1. disrpt.py +6 -5
disrpt.py CHANGED
@@ -123,7 +123,7 @@ class Dataset(datasets.GeneratorBasedBuilder):
123
  base_kwargs_names=get_kwarg_names(super().__init__)
124
  gen_kwargs={}
125
  self.files={}
126
- self.preprocessed_underscores=False
127
  for k,v in copy.deepcopy(kwargs).items():
128
  if k not in base_kwargs_names:
129
  gen_kwargs[k]=v
@@ -157,15 +157,16 @@ class Dataset(datasets.GeneratorBasedBuilder):
157
 
158
  def _generate_examples(self, filepath):
159
  print(filepath)
160
-
161
  run_args={
 
162
  'rel_files': [v for k, v in self.files.items() if 'rels' in k],
163
  'dep_files': [v for k, v in self.files.items() if 'conllu' in k]
164
  }
165
  print('run_args',run_args)
166
- if not self.preprocessed_underscores:
167
- run('gum', **run_args)
168
- self.preprocessed_underscores=True
169
 
170
  with open(filepath, encoding="utf-8") as f:
171
  if "conllu" in self.config.name:
 
123
  base_kwargs_names=get_kwarg_names(super().__init__)
124
  gen_kwargs={}
125
  self.files={}
126
+ self.preprocessed_underscores=dict()
127
  for k,v in copy.deepcopy(kwargs).items():
128
  if k not in base_kwargs_names:
129
  gen_kwargs[k]=v
 
157
 
158
  def _generate_examples(self, filepath):
159
  print(filepath)
160
+ corpus=self.config.name.split('.')[2]
161
  run_args={
162
+ 'corpus':corpus
163
  'rel_files': [v for k, v in self.files.items() if 'rels' in k],
164
  'dep_files': [v for k, v in self.files.items() if 'conllu' in k]
165
  }
166
  print('run_args',run_args)
167
+ if corpus in ['rstdt','pdtb','cdtb','gum','tdb'] and not self.preprocessed_underscores[corpus]:
168
+ run(**run_args)
169
+ self.preprocessed_underscores[corpus]=True
170
 
171
  with open(filepath, encoding="utf-8") as f:
172
  if "conllu" in self.config.name: