mirror of
https://github.com/explosion/spaCy.git
synced 2025-08-05 21:00:19 +03:00
Fix case for len(ent.sents) == 1.
This commit is contained in:
parent
64191755b6
commit
16b47eb387
|
@ -484,10 +484,13 @@ class EntityLinker(TrainablePipe):
|
|||
# 2. "8 was beautiful"
|
||||
# This makes it tricky to receive the last sentence by indexing doc.sents - hence we use an offset
|
||||
# to determine sent_indices[1].
|
||||
sent_indices = (
|
||||
sentences.index(sents[0]),
|
||||
sentences.index(sents[0]) + len(sents) - 1,
|
||||
)
|
||||
if len(sents) > 1:
|
||||
sent_indices = (
|
||||
sentences.index(sents[0]),
|
||||
sentences.index(sents[0]) + len(sents) - 1,
|
||||
)
|
||||
else:
|
||||
sent_indices = (sentences.index(ent.sent), sentences.index(ent.sent))
|
||||
assert all([si >= 0 for si in sent_indices])
|
||||
|
||||
if self.incl_context:
|
||||
|
|
Loading…
Reference in New Issue
Block a user