Optimize local parse_brat_file
Browse files
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 |
-
|
| 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"] = []
|