From 98747de62bf7352ab1da824214c9b8612bdecc6b Mon Sep 17 00:00:00 2001 From: svlandeg Date: Tue, 2 Apr 2024 09:47:11 +0200 Subject: [PATCH] allow for scorer to be None --- spacy/pipeline/entity_linker.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spacy/pipeline/entity_linker.py b/spacy/pipeline/entity_linker.py index ddd181937..40a9c8a79 100644 --- a/spacy/pipeline/entity_linker.py +++ b/spacy/pipeline/entity_linker.py @@ -244,6 +244,8 @@ class EntityLinker(TrainablePipe): def _score_with_ents_set(examples: Iterable[Example], **kwargs): # Because of how spaCy works, we can't just score immediately, because Language.evaluate # calls pipe() on the predicted docs, which won't have entities if there is no NER in the pipeline. + if not scorer: + return scorer if not self.use_gold_ents: return scorer(examples, **kwargs) else: