cryptexcode commited on
Commit
0fbead7
·
1 Parent(s): ff79626

Update multiconer_v2.py

Browse files
Files changed (1) hide show
  1. multiconer_v2.py +3 -3
multiconer_v2.py CHANGED
@@ -283,14 +283,14 @@ class MultiCoNER2(datasets.GeneratorBasedBuilder):
283
  datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": downloaded_files["test"]}),
284
  ]
285
 
286
- def _generate_examples(self, filepath):
287
  logger.info("⏳ Generating examples from = %s", filepath)
288
  with open(filepath, encoding="utf-8") as f:
289
  guid = 0
290
  tokens = []
291
  ner_tags = []
292
  for line in f.read().strip().split('\n'):
293
- if line.startswith("# id") or line == "" or line == "\n":
294
  if tokens:
295
  yield guid, {
296
  "id": str(guid),
@@ -302,7 +302,7 @@ class MultiCoNER2(datasets.GeneratorBasedBuilder):
302
  ner_tags = []
303
  else:
304
  # Separator is " _ _ "
305
- splits = line.split(" _ _ ")
306
  tokens.append(splits[0].strip())
307
  ner_tags.append(splits[1].strip())
308
 
 
283
  datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": downloaded_files["test"]}),
284
  ]
285
 
286
+ def _generate_examples(self, filepath):
287
  logger.info("⏳ Generating examples from = %s", filepath)
288
  with open(filepath, encoding="utf-8") as f:
289
  guid = 0
290
  tokens = []
291
  ner_tags = []
292
  for line in f.read().strip().split('\n'):
293
+ if line.startswith("# id") or line == "" or line == "\n" or "_ _" not in line:
294
  if tokens:
295
  yield guid, {
296
  "id": str(guid),
 
302
  ner_tags = []
303
  else:
304
  # Separator is " _ _ "
305
+ splits = line.split("_ _")
306
  tokens.append(splits[0].strip())
307
  ner_tags.append(splits[1].strip())
308