mirror of
https://github.com/explosion/spaCy.git
synced 2025-07-19 20:52:23 +03:00
Minor optimization
This commit is contained in:
parent
cb2364cf83
commit
fce804a79f
|
@ -143,9 +143,12 @@ 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
|
||||
if ei < len(doc) and sentence_map[ei] == si:
|
||||
begins.append(tok.i)
|
||||
ends.append(ei)
|
||||
|
||||
if ei > len(doc) or sentence_map[ei] != si:
|
||||
continue
|
||||
|
||||
begins.append(tok.i)
|
||||
ends.append(ei)
|
||||
|
||||
return (begins, ends)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user