0

This first one uses asterisk by the other_pipes list:

nlp = spacy.load("en")
other_pipes = [pipe for pipe in nlp.pipe_names if pipe != "ner"]
nlp.disable_pipes(other_pipes)

However this other one doesn't:

nlp = spacy.load("en")
other_pipes = [pipe for pipe in nlp.pipe_names if pipe != "ner"]
nlp.disable_pipes(*other_pipes)

Even so they had similar outputs:

First:

[('tagger', <spacy.pipeline.pipes.Tagger at 0x2103ab55c88>),
 ('parser', <spacy.pipeline.pipes.DependencyParser at 0x2103a84cc48>)]

Second:

[('tagger', <spacy.pipeline.pipes.Tagger at 0x222faa86cc8>),
 ('parser', <spacy.pipeline.pipes.DependencyParser at 0x222f97bcca8>)]
khelwood
  • 55,782
  • 14
  • 81
  • 108

0 Answers0