How to remove the default patterns on EntityRuler? #5025
-
I am working in a Jupyter Notebook for running EntityRuler:
When I run the rule and get "doc.ents" it shows other labels like 'CARDINAL', 'ORDINAL', 'GPE', 'ORG', 'PERSON', etc... How can I remove those rules from EntityRuler? I only want my rules to run on the text. Info about spaCy
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
The labels 'CARDINAL' etc. you're seeing, are not coming from default rules in the EntityRuler, but are in fact produced by a pretrained NER component that is part of the pretrained model you're loading. To remove this component, you can either run your code in a The other option you have is to start with a blank model, e.g. |
Beta Was this translation helpful? Give feedback.
-
Thank you @svlandeg . It's working as I expected now. |
Beta Was this translation helpful? Give feedback.
The labels 'CARDINAL' etc. you're seeing, are not coming from default rules in the EntityRuler, but are in fact produced by a pretrained NER component that is part of the pretrained model you're loading. To remove this component, you can either run your code in a
with nlp.disable_pipes("ner"):
block to disable it temporarily, or you can remove it completely by runningnlp.remove_pipe("ner")
.The other option you have is to start with a blank model, e.g.
nlp = English()
which doesn't have any pretrained components (also no sentence splitter!).