As we said in the Part-of-speech tagging section, PoS tagging is the process of labeling text words that correspond to particular lexical categories. The common linguistic categories include nouns, verbs, adjectives, articles, pronouns, adverbs, conjunctions, and so on. To automatically label each word of a text automatically with its word class, the nltk package has a specific method: pos_tag. This method contains classes and interfaces for part-of-speech tagging, or simply tagging. A tag is a case-sensitive string that specifies some property of token, such as its part of speech. Tagged tokens are encoded as tuples (tag, token). First, we need to import the method:
from nltk import pos_tag
After importing the pos_tag() ...