-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Natural Language Processing with Flair
By :
PoS taggers are responsible for tagging/labeling tokens with their corresponding parts of speech. A simplified set of parts-of-speech categories consists of nouns, verbs, adjectives, and adverbs. However, most taggers in Flair use larger, more descriptive tag sets. For example, the Penn tag set consists of 36 different tags.
The tagging process and PoS tagging syntax is no different from NER or any other tagging task in Flair. The only difference in loading a PoS tagger is choosing the right tagger ID that corresponds to our PoS tagger of choice.
Let's experiment with the default English PoS tagger in Flair using the pos tagger ID:
from flair.data import Sentence
from flair.models import SequenceTagger
tagger = SequenceTagger.load('pos')
sentence = Sentence('Making a living')
tagger.predict(sentence)
print(sentence.to_tagged_string())
In the preceding script, we loaded Flair's default English pos tagger and tagged...