Merge pull request #6524 from adrianeboyd/bugfix/entity-ruler-subsequent

Fix subsequent pipe detection in EntityRuler
This commit is contained in:
Ines Montani 2020-12-08 22:17:28 +11:00 committed by GitHub
commit 4e77349106
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -198,7 +198,11 @@ class EntityRuler(object):
# disable the nlp components after this one in case they hadn't been initialized / deserialised yet # disable the nlp components after this one in case they hadn't been initialized / deserialised yet
try: 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 = [ subsequent_pipes = [
pipe for pipe in self.nlp.pipe_names[current_index + 1 :] pipe for pipe in self.nlp.pipe_names[current_index + 1 :]
] ]