How can I add new POS tag in spacy for English

Viewed 216

For POS tagging, I am using spacy. I found pos tags for gerund and infinitives are not given. How can I add these two new tags in spacy? I can change tags within the list but not able to add new tags. Please help. Thank you.

**pattern = [tokens[t].pos_== "VERB" and tokens[t-1].pos_=="ADP" for t in range 
(len(tokens)-1)]
 spacy.pipeline.tagger.Tagger.add_label(u"GERUND")**

this gives error:

 TypeError: add_label() takes exactly 2 positional arguments (1 given)
1 Answers

Rather than modifying the output, it sounds like you should just use the .tag_ attribute, which is more detailed and language specific. In this case the value will be VB for an infinitive and VBG for a gerund. These are Penn Treebank Tags.

The .pos_ values are from Universal Dependencies, and are less detailed but appropriate for multi-lingual applications.

Related