From fc0f954d9b8b85b5821b9420042ab55b7c1ef458 Mon Sep 17 00:00:00 2001 From: Raphael Mitsch Date: Tue, 14 Mar 2023 13:18:11 +0100 Subject: [PATCH] Format. Update assert in ent.sents handling. --- spacy/pipeline/entity_linker.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/spacy/pipeline/entity_linker.py b/spacy/pipeline/entity_linker.py index 403921076..549a281e2 100644 --- a/spacy/pipeline/entity_linker.py +++ b/spacy/pipeline/entity_linker.py @@ -476,8 +476,11 @@ class EntityLinker(TrainablePipe): for j, ent in enumerate(ent_batch): assert hasattr(ent, "sents") sents = list(ent.sents) - sent_indices = (sentences.index(sents[0]), sentences.index(sents[-1])) - assert all([si >= 0 for si in sent_indices]) + sent_indices = ( + sentences.index(sents[0]), + sentences.index(sents[-1]), + ) + assert sent_indices[-1] >= sent_indices[0] >= 0 if self.incl_context: # get n_neighbour sentences, clipped to the length of the document