Search code examples
python-3.xnlpspacy

Disabling part of the nlp pipeline


I am running spaCy v2.x on a windows box with python3. I do not have admin privelages, so i have to call the pipeline as:

nlp = en_core_web_sm.load()

When I run my same script on a *nix box, I can load the pipeline as:

nlp = spacy.load('en', disable = ['ner', 'tagger', 'parser', 'textcat'])

All I am do is tokenizing, so I do not need the entire pipeline. On the windows box, if I load the pipeline like:

nlp = en_core_web_sm.load(disable = ['ner', 'tagger', 'parser', 'textcat'])

Does that actually disable the components?

spaCy information on the nlp pipeline


Solution

  • You can check the current pipeline components by

    print(nlp.pipe_names)
    

    If you are not convinced by the output, you can manually check by trying to use the component and try to print the output. E.g try to disable parser and print dependency tags.