elenanereiss commited on
Commit
25ee654
1 Parent(s): 4dfbe0d

Update german-ler.py

Browse files
Files changed (1) hide show
  1. german-ler.py +9 -8
german-ler.py CHANGED
@@ -174,16 +174,17 @@ class German_LER(datasets.GeneratorBasedBuilder):
174
  current_labels.append(label)
175
 
176
  # generate coarse-grained tags
177
- if label == 'O': continue
 
178
  else:
179
  bio, fine_tag = label.split("-")
180
- if fine_tag in ['PER', 'RR', 'AN']: label = bio + '-PER'
181
- elif fine_tag in ['LD', 'ST', 'STR', 'LDS']: label = bio + '-LOC'
182
- elif fine_tag in ['ORG', 'UN', 'INN', 'GRT', 'MRK']: label = bio + '-ORG'
183
- elif fine_tag in ['GS', 'VO', 'EUN']: label = bio + '-NRM'
184
- elif fine_tag in ['VS', 'VT']: label = bio + '-REG'
185
- else: continue
186
- current_coarse_labels.append(label)
187
 
188
  else:
189
  if not current_words:
 
174
  current_labels.append(label)
175
 
176
  # generate coarse-grained tags
177
+ new_label = ""
178
+ if label == 'O': new_label = label
179
  else:
180
  bio, fine_tag = label.split("-")
181
+ if fine_tag in ['PER', 'RR', 'AN']: new_label = bio + '-PER'
182
+ elif fine_tag in ['LD', 'ST', 'STR', 'LDS']: new_label = bio + '-LOC'
183
+ elif fine_tag in ['ORG', 'UN', 'INN', 'GRT', 'MRK']: new_label = bio + '-ORG'
184
+ elif fine_tag in ['GS', 'VO', 'EUN']: new_label = bio + '-NRM'
185
+ elif fine_tag in ['VS', 'VT']: new_label = bio + '-REG'
186
+ else: new_label = label
187
+ current_coarse_labels.append(new_label)
188
 
189
  else:
190
  if not current_words: