From e43d43db32e66d7f03177b4214cd26dbacb9b4ed Mon Sep 17 00:00:00 2001 From: Adriane Boyd Date: Fri, 26 Feb 2021 13:50:56 +0100 Subject: [PATCH] Allow sourcing disabled components (#7215) Check `component_names` instead of `pipe_names` to allow sourcing disabled components. --- spacy/language.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spacy/language.py b/spacy/language.py index 5bd1545d2..2a9b50bcc 100644 --- a/spacy/language.py +++ b/spacy/language.py @@ -684,12 +684,12 @@ class Language: # TODO: handle errors and mismatches (vectors etc.) if not isinstance(source, self.__class__): raise ValueError(Errors.E945.format(name=source_name, source=type(source))) - if not source.has_pipe(source_name): + if not source_name in source.component_names: raise KeyError( Errors.E944.format( name=source_name, model=f"{source.meta['lang']}_{source.meta['name']}", - opts=", ".join(source.pipe_names), + opts=", ".join(source.component_names), ) ) pipe = source.get_pipe(source_name)