diff --git a/spacy/pipeline/entity_linker.py b/spacy/pipeline/entity_linker.py index 5acff1472..a9a3fe1d0 100644 --- a/spacy/pipeline/entity_linker.py +++ b/spacy/pipeline/entity_linker.py @@ -484,16 +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]. - 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), - ) + sent_indices = ( + sentences.index(sents[0]), + sentences.index(sents[0]) + len(sents) - 1, + ) if len(sents) > 1 else ( + sentences.index(ent.sent), + sentences.index(ent.sent), + ) assert all([si >= 0 for si in sent_indices]) if self.incl_context: