Skip to content

Commit e6db7b3

Browse files
committed
AddBratAnn do not fail on trailing whitespace on R-lines
1 parent bd2e61f commit e6db7b3

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

udapi/block/read/addbratann.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,12 @@ def process_document(self, document):
7777
except Exception as e:
7878
logging.warning(f"Unexpected mention line: {line}\n{e}")
7979
elif line.startswith(self.coref_attr):
80-
cor_attr, mention_ids = line.split("\t")
81-
parts = mention_ids.split()
82-
assert(parts[0] == "Coreference")
80+
try:
81+
cor_attr, mention_ids = line.rstrip().split("\t")
82+
parts = mention_ids.split()
83+
assert(parts[0] == "Coreference")
84+
except Exception as e:
85+
logging.warning(f"Unexpected coref line: '{line}'\n{e}")
8386
clusters.append([p.split(":")[1] for p in parts[1:]])
8487
elif line.startswith("#"):
8588
pass # Let's ignore annotators' comments

0 commit comments

Comments
 (0)