albertvillanova HF staff commited on
Commit
36bc69a
1 Parent(s): 4ee9af4

Do not yield trailing empty example

Browse files
Files changed (1) hide show
  1. bc2gm_corpus.py +6 -5
bc2gm_corpus.py CHANGED
@@ -135,8 +135,9 @@ class Bc2gmCorpus(datasets.GeneratorBasedBuilder):
135
  tokens.append(splits[0])
136
  ner_tags.append(splits[1].rstrip())
137
  # last example
138
- yield guid, {
139
- "id": str(guid),
140
- "tokens": tokens,
141
- "ner_tags": ner_tags,
142
- }
 
 
135
  tokens.append(splits[0])
136
  ner_tags.append(splits[1].rstrip())
137
  # last example
138
+ if tokens:
139
+ yield guid, {
140
+ "id": str(guid),
141
+ "tokens": tokens,
142
+ "ner_tags": ner_tags,
143
+ }