diff --git a/spacy/ml/models/coref_util.py b/spacy/ml/models/coref_util.py index 7c7751022..88997f5e3 100644 --- a/spacy/ml/models/coref_util.py +++ b/spacy/ml/models/coref_util.py @@ -128,9 +128,10 @@ def get_candidate_mentions( si = sentence_map[tok.i] # sentence index for ii in range(1, max_span_width): ei = tok.i + ii # end index + # Note: this matches slice syntax, so the token index is one less if ei > len(doc) or sentence_map[ei - 1] != si: - continue + break begins.append(tok.i) ends.append(ei)