This commit is contained in:
Raphael Mitsch 2023-03-10 14:21:31 +01:00
parent 8c88543c0c
commit e64a9ea499

View File

@ -485,12 +485,16 @@ class EntityLinker(TrainablePipe):
# This makes it tricky to receive the last sentence by indexing doc.sents - hence we use an offset # This makes it tricky to receive the last sentence by indexing doc.sents - hence we use an offset
# to determine sent_indices[1]. # to determine sent_indices[1].
sent_indices = ( sent_indices = (
(
sentences.index(sents[0]), sentences.index(sents[0]),
sentences.index(sents[0]) + len(sents) - 1, sentences.index(sents[0]) + len(sents) - 1,
) if len(sents) > 1 else ( )
if len(sents) > 1
else (
sentences.index(ent.sent), sentences.index(ent.sent),
sentences.index(ent.sent), sentences.index(ent.sent),
) )
)
assert all([si >= 0 for si in sent_indices]) assert all([si >= 0 for si in sent_indices])
if self.incl_context: if self.incl_context: