From f5f20b0b92a3d26598d8eecfe1780b512853558b Mon Sep 17 00:00:00 2001 From: Raphael Mitsch Date: Sun, 23 Oct 2022 18:32:55 +0200 Subject: [PATCH] Fix bug in check for doc NEL viability. --- spacy/pipeline/entity_linker.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spacy/pipeline/entity_linker.py b/spacy/pipeline/entity_linker.py index c3a0a3815..a8c8d4278 100644 --- a/spacy/pipeline/entity_linker.py +++ b/spacy/pipeline/entity_linker.py @@ -467,7 +467,7 @@ class EntityLinker(TrainablePipe): if doc.ents[idx].label_ not in self.labels_discard ] for doc in docs - if len(doc.ents) + if len(doc) and len(doc.ents) ) # Call candidate generator. if self.candidates_doc_mode: @@ -476,7 +476,7 @@ class EntityLinker(TrainablePipe): ( [doc.ents[idx] for idx in next(valid_ent_idx_per_doc)] for doc in docs - if len(docs) and len(doc.ents) + if len(doc) and len(doc.ents) ), ) else: @@ -487,7 +487,7 @@ class EntityLinker(TrainablePipe): for idx in next(valid_ent_idx_per_doc) ] for doc in docs - if len(docs) and len(doc.ents) + if len(doc) and len(doc.ents) ) for doc_idx, doc in enumerate(docs):