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
|
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) and sentence_map[ei] == si:
|
|
||||||
begins.append(tok.i)
|
if ei > len(doc) or sentence_map[ei] != si:
|
||||||
ends.append(ei)
|
continue
|
||||||
|
|
||||||
|
begins.append(tok.i)
|
||||||
|
ends.append(ei)
|
||||||
|
|
||||||
return (begins, ends)
|
return (begins, ends)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user