Part-of-Speech Tagging
Learn how to perform part-of-speech tagging using Python.
We'll cover the following...
Introduction
Labeling words in a sentence with their appropriate grammatical categories, such as nouns, verbs, adjectives, or adverbs, is known as part-of-speech (POS) tagging. This technique enables us to understand a sentence’s syntactic structure and determine a word’s meaning about other words. For instance, in the sentence “The cat sat on the mat,” the words “cat” and “mat” would be tagged as nouns, “sat” as a verb, “the” as a determiner, and “on” as a preposition. By assigning each word to a grammatical category, we ensure that we prepare our data for later analysis, such as text classification, sentiment analysis, and information retrieval. Here are some common POS tags.
Common POS Tags
Short form | Full form | Meaning | Example |
JJS | Adjective | Superlative form of an adjective | “best” (It’s the best option.) |
RB | Adverb | Modifies a verb, adjective, or other adverbs | “quickly” (He ran quickly.) |
NUM | Numeral | Represents numbers and quantities | “three” (There are three apples.) |
PRP | Pronoun | Replaces a noun or noun phrase | “she” (She is going to the park.) |
PUNCT or , or . | Punctuation | Includes various punctuation marks | “.” (Period at the end of a sentence) |
VERB | Verb | Expresses actions, events, or states | “run” (They run every morning.) |
MD | Modal Verb | Expresses possibility, necessity, or permission | “can” (He can swim.) |
NN | Noun | Represents a person, place, thing, or idea | “city” (The city is beautiful.) |
NNP | Proper Noun, Singular | Singular proper noun | “Alice” (Alice Johnson.) |
NNPS | Proper Noun, Plural | Plural proper noun | “Smiths” (The Smiths band.) |
IN | Preposition | Shows a relationship between a noun/pronoun and another word in the sentence | “in” (He is in the room.) |
CD | Cardinal Digit | Numerical digits | “2023” (The year 2023.) |
DT | Determiner | Specifies or limits a noun | “the” (He used the book.) |
VBG | Verb, Gerund or Present Participle | Represents an action or process in progress | “running” (He is running.) |
JJ | Verb, 3rd Person Singular | Indicates an action performed by the subject in the third person singular | “runs” (She runs fast.) |
VBN | Past Participle Verb | Indicates an action that has occurred in the past and is often used with auxiliary verbs | “eaten” (He has eaten lunch.) |
While POS tagging provides benefits and advantages, there are some limitations to take into account:
Some words can have numerous ...