mirror of
https://github.com/explosion/spaCy.git
synced 2025-07-19 20:52:23 +03:00
Fix mention list bug
There was an off-by-one error in how mentions are generated that would affect mentions at the end of a sentence. This was pretty nasty.
This commit is contained in:
parent
80a17071d3
commit
f1796e4af7
|
@ -128,7 +128,8 @@ def get_candidate_mentions(
|
||||||
si = sentence_map[tok.i] # sentence index
|
si = sentence_map[tok.i] # sentence index
|
||||||
for ii in range(1, max_span_width):
|
for ii in range(1, max_span_width):
|
||||||
ei = tok.i + ii # end index
|
ei = tok.i + ii # end index
|
||||||
if ei >= len(doc) or sentence_map[ei] != si:
|
# Note: this matches slice syntax, so the token index is one less
|
||||||
|
if ei > len(doc) or sentence_map[ei-1] != si:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
begins.append(tok.i)
|
begins.append(tok.i)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user