Datasets:

Modalities:
Text
Languages:
English
Libraries:
Datasets
License:
albertvillanova HF staff commited on
Commit
90bf9d3
·
verified ·
1 Parent(s): d1d4571

Optimize local parse_brat_file

Browse files
Files changed (1) hide show
  1. chia.py +3 -1
chia.py CHANGED
@@ -520,9 +520,11 @@ def parse_brat_file(txt_file: Path, annotation_file_suffixes: List[str] = None)
520
  ann_lines = []
521
  for suffix in annotation_file_suffixes:
522
  annotation_file = txt_file.with_suffix(suffix)
523
- if annotation_file.exists():
524
  with annotation_file.open() as f:
525
  ann_lines.extend(f.readlines())
 
 
526
 
527
  example["text_bound_annotations"] = []
528
  example["events"] = []
 
520
  ann_lines = []
521
  for suffix in annotation_file_suffixes:
522
  annotation_file = txt_file.with_suffix(suffix)
523
+ try:
524
  with annotation_file.open() as f:
525
  ann_lines.extend(f.readlines())
526
+ except Exception:
527
+ continue
528
 
529
  example["text_bound_annotations"] = []
530
  example["events"] = []