Reputation: 11
I would like to add some tags to "en_core_web_sm"
For example: I want the Spacy NER model to tag "16GB" as a RAM and "Intel core i7" as a CPU
How can I do this?
I tried the following:
nlp = spacy.load("en_core_web_sm")
ruler = EntityRuler(nlp)
patterns = [{"label": "RAM", "pattern": "16gb ram"}]
ruler = nlp.add_pipe("entity_ruler")
ruler.add_patterns(patterns)
doc = nlp("16gb ram is my order")
for ent in doc.ents:
print(ent.text,ent.label_)
and the output was: 16 CARDINAL
Upvotes: 1
Views: 991