From 1d1679d4319f75d918548c450ff346e991031bc9 Mon Sep 17 00:00:00 2001 From: Paul O'Leary McCann Date: Wed, 21 Jul 2021 19:50:10 +0900 Subject: [PATCH] Minor speedup This continue should be a break. The current form doesn't cause errors but using a break will be a bit faster. --- spacy/ml/models/coref_util.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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)