From f5f054c43039bc59e02930913464eec958232edd Mon Sep 17 00:00:00 2001 From: ssubraveti Date: Wed, 23 Sep 2020 10:21:04 -0700 Subject: [PATCH] Fix case where multiple spans are covered by a single entity --- tools/anntoconll.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/anntoconll.py b/tools/anntoconll.py index adcd334c3..d74153a1c 100644 --- a/tools/anntoconll.py +++ b/tools/anntoconll.py @@ -262,10 +262,11 @@ def parse_textbounds(f): continue id_, type_offsets, text = l.split('\t') - type_, start, end = type_offsets.split() - start, end = int(start), int(end) - - textbounds.append(Textbound(start, end, type_, text)) + offsets = ' '.join(type_offsets.split()[1:]).split(';') + for offset in offsets: + start = int(offset.split()[0]) + end = int(offset.split()[1]) + textbounds.append(Textbound(start, end, type_, text)) return textbounds