From 6c221d4841126ae6e923b02df28c303bba5d3bd6 Mon Sep 17 00:00:00 2001 From: Adriane Boyd Date: Tue, 8 Dec 2020 10:01:30 +0100 Subject: [PATCH] Fix subsequent pipe detection in EntityRuler Fix subsequent pipe detection to detect the position of the current object by comparing the component itself rather than from the factory name. --- spacy/pipeline/entityruler.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/spacy/pipeline/entityruler.py b/spacy/pipeline/entityruler.py index 2abff62f1..3385da049 100644 --- a/spacy/pipeline/entityruler.py +++ b/spacy/pipeline/entityruler.py @@ -198,7 +198,11 @@ class EntityRuler(object): # disable the nlp components after this one in case they hadn't been initialized / deserialised yet try: - current_index = self.nlp.pipe_names.index(self.name) + current_index = -1 + for i, (name, pipe) in enumerate(self.nlp.pipeline): + if self == pipe: + current_index = i + break subsequent_pipes = [ pipe for pipe in self.nlp.pipe_names[current_index + 1 :] ]