Skip to content

Commit 9a1a50e

Browse files
committed
Patch for if the MWT expander returns exactly one expansion - do not need to turn it into a true MWT
1 parent f6360f7 commit 9a1a50e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

stanza/models/common/doc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ def set_mwt_expansions(self, expansions,
368368
idx_w_end = idx_w + len(expanded) - 1
369369
if token.misc: # None can happen when using a prebuilt doc
370370
token.misc = None if token.misc == 'MWT=Yes' else '|'.join([x for x in token.misc.split('|') if x != 'MWT=Yes'])
371-
token.id = (idx_w, idx_w_end)
371+
token.id = (idx_w, idx_w_end) if len(expanded) > 1 else (idx_w,)
372372
token.words = []
373373
for i, e_word in enumerate(expanded):
374374
token.words.append(Word(sentence, {ID: idx_w + i, TEXT: e_word}))

0 commit comments

Comments
 (0)