With the NLTK library, it is often difficult to find your way around, especially with the tags module (pos_tag)!
This module allows you to know the value of each word : adjective, noun, proper name, etc.
In this post, we propose you a summary table of each NLKT tags and their correspondence 😉
Tags NLTK
Tag | Meaning |
CC | Coordinating conjunction |
CD | Cardinal number |
DT | Determiner |
EX | Existential there |
FW | Foreign word |
IN | Preposition or subordinating conjunction |
JJ | Adjective |
VP | Verb Phrase |
JJR | Adjective, comparative |
JJS | Adjective, superlative |
LS | List item marker |
MD | Modal |
NN | Noun, singular or mass |
NNS | Noun, plural |
PP | Preposition Phrase |
NNP | Proper noun, singular Phrase |
NNPS | Proper noun, plural |
PDT | Pre determiner |
POS | Possessive ending |
PRP | Personal pronoun Phrase |
PRP | Possessive pronoun Phrase |
RB | Adverb |
RBR | Adverb, comparative |
RBS | Adverb, superlative |
RP | Particle |
S | Simple declarative clause |
SBAR | Clause introduced by a (possibly empty) subordinating conjunction |
SBARQ | Direct question introduced by a wh-word or a wh-phrase. |
SINV | Inverted declarative sentence, i.e. one in which the subject follows the tensed verb or modal. |
SQ | Inverted yes/no question, or main clause of a wh-question, following the wh-phrase in SBARQ. |
SYM | Symbol |
VB | Verb, base form |
VBD | Verb, past tense |
VBG | Verb, gerund or present participle |
VBN | Verb, past participle |
VBP | Verb, non-3rd person singular present |
VBZ | Verb, 3rd person singular present |
WDT | Wh-determiner |
WP | Wh-pronoun |
WP | Possessive wh-pronoun |
WRB | Wh-adverb |
Short example of the use of the nltk.tag module :
from nltk import tag
tag.pos_tag(['I', 'am', 'a', 'tag', 'from', 'NLTK'])
Output : [(‘I’, ‘PRP’), (‘am’, ‘VBP’), (‘a’, ‘DT’), (‘tag’, ‘NN’), (‘from’, ‘IN’), (‘NLTK’, ‘NNP’)]
The tags from the NLTK library is used a lot for NLP projects but others use more classical libraries.
In this article especially, we use typical Machine Learning libraries for text classification.
A tutorial that we warmly recommend ! 🔥
One last word, if you want to go further and learn about Deep Learning - I've prepared for you the Action plan to Master Neural networks. for you.
7 days of free advice from an Artificial Intelligence engineer to learn how to master neural networks from scratch:
- Plan your training
- Structure your projects
- Develop your Artificial Intelligence algorithms
I have based this program on scientific facts, on approaches proven by researchers, but also on my own techniques, which I have devised as I have gained experience in the field of Deep Learning.
To access it, click here :