SuzanaB commited on
Commit
6a5ed65
1 Parent(s): 82efead

Fix file paths and special lines

Browse files
Files changed (1) hide show
  1. hr500k.py +8 -2
hr500k.py CHANGED
@@ -39,6 +39,12 @@ _URLs = {
39
  'ud': 'https://huggingface.co/datasets/classla/hr500k/raw/main/data_ud.zip'
40
  }
41
 
 
 
 
 
 
 
42
 
43
  class Hr500K(datasets.GeneratorBasedBuilder):
44
  VERSION = datasets.Version('1.0.1')
@@ -164,7 +170,7 @@ class Hr500K(datasets.GeneratorBasedBuilder):
164
 
165
  def _split_generators(self, dl_manager):
166
  """Returns SplitGenerators."""
167
- data_dir = dl_manager.download_and_extract(_URLs[self.config.name])
168
 
169
  if self.config.name == 'ud':
170
  training_file = 'train_ner_ud.conllup'
@@ -207,7 +213,7 @@ class Hr500K(datasets.GeneratorBasedBuilder):
207
  uds = []
208
  data_id = 0
209
  for line in f:
210
- if line and not line == '\n':
211
  if line.startswith('#'):
212
  if line.startswith('# sent_id'):
213
  if tokens:
39
  'ud': 'https://huggingface.co/datasets/classla/hr500k/raw/main/data_ud.zip'
40
  }
41
 
42
+ _DATA_DIRS = {
43
+ 'ner': 'data_ner',
44
+ 'upos': 'data_ner',
45
+ 'ud': 'data_ud'
46
+ }
47
+
48
 
49
  class Hr500K(datasets.GeneratorBasedBuilder):
50
  VERSION = datasets.Version('1.0.1')
170
 
171
  def _split_generators(self, dl_manager):
172
  """Returns SplitGenerators."""
173
+ data_dir = os.path.join(dl_manager.download_and_extract(_URLs[self.config.name]), _DATA_DIRS[self.config.name])
174
 
175
  if self.config.name == 'ud':
176
  training_file = 'train_ner_ud.conllup'
213
  uds = []
214
  data_id = 0
215
  for line in f:
216
+ if line and not line == '\n' and not line.startswith('# global.columns'):
217
  if line.startswith('#'):
218
  if line.startswith('# sent_id'):
219
  if tokens: