Skip to content Skip to sidebar Skip to footer

How To Extract Tag Attributes Using Spacy

I tried to get the morphological attributes of the verb using Spacy like below: import spacy from spacy.lang.it.examples import sentences nlp = spacy.load('it_core_news_sm') doc =

Solution 1:

The nlp.vocab.morphology.tag_map maps from the detailed tag to the dict with simpler tag, so you just need to skip that step and inspect the tag directly:

import spacy
nlp = spacy.load('it')
doc = nlp('Ti รจ piaciuto il film?')
print(doc[2].tag_)

should return

VA__Mood=Ind|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin

(with spacy 2.0.11, it_core_news_sm-2.0.0)

Post a Comment for "How To Extract Tag Attributes Using Spacy"