How do I find a list with all possible POS tags used by the Natural Language Toolkit (NLTK)?
9 Answers
To save some folks some time, here is a list I extracted from a small corpus. I do not know if it is complete, but it should have most (if not all) of the help definitions from upenn_tagset...
CC: conjunction, coordinating
& 'n and both but either et for less minus neither nor or plus so
therefore times v. versus vs. whether yet
CD: numeral, cardinal
mid-1890 nine-thirty forty-two one-tenth ten million 0.5 one forty-
seven 1987 twenty '79 zero two 78-degrees eighty-four IX '60s .025
fifteen 271,124 dozen quintillion DM2,000 ...
DT: determiner
all an another any both del each either every half la many much nary
neither no some such that the them these this those
EX: existential there
there
IN: preposition or conjunction, subordinating
astride among upon whether out inside pro despite on by throughout
below within for towards near behind atop around if like until below
next into if beside ...
JJ: adjective or numeral, ordinal
third ill-mannered pre-war regrettable oiled calamitous first separable
ectoplasmic battery-powered participatory fourth still-to-be-named
multilingual multi-disciplinary ...
JJR: adjective, comparative
bleaker braver breezier briefer brighter brisker broader bumper busier
calmer cheaper choosier cleaner clearer closer colder commoner costlier
cozier creamier crunchier cuter ...
JJS: adjective, superlative
calmest cheapest choicest classiest cleanest clearest closest commonest
corniest costliest crassest creepiest crudest cutest darkest deadliest
dearest deepest densest dinkiest ...
LS: list item marker
A A. B B. C C. D E F First G H I J K One SP-44001 SP-44002 SP-44005
SP-44007 Second Third Three Two * a b c d first five four one six three
two
MD: modal auxiliary
can cannot could couldn't dare may might must need ought shall should
shouldn't will would
NN: noun, common, singular or mass
common-carrier cabbage knuckle-duster Casino afghan shed thermostat
investment slide humour falloff slick wind hyena override subhumanity
machinist ...
NNP: noun, proper, singular
Motown Venneboerger Czestochwa Ranzer Conchita Trumplane Christos
Oceanside Escobar Kreisler Sawyer Cougar Yvette Ervin ODI Darryl CTCA
Shannon A.K.C. Meltex Liverpool ...
NNS: noun, common, plural
undergraduates scotches bric-a-brac products bodyguards facets coasts
divestitures storehouses designs clubs fragrances averages
subjectivists apprehensions muses factory-jobs ...
PDT: pre-determiner
all both half many quite such sure this
POS: genitive marker
' 's
PRP: pronoun, personal
hers herself him himself hisself it itself me myself one oneself ours
ourselves ownself self she thee theirs them themselves they thou thy us
PRP$: pronoun, possessive
her his mine my our ours their thy your
RB: adverb
occasionally unabatingly maddeningly adventurously professedly
stirringly prominently technologically magisterially predominately
swiftly fiscally pitilessly ...
RBR: adverb, comparative
further gloomier grander graver greater grimmer harder harsher
healthier heavier higher however larger later leaner lengthier less-
perfectly lesser lonelier longer louder lower more ...
RBS: adverb, superlative
best biggest bluntest earliest farthest first furthest hardest
heartiest highest largest least less most nearest second tightest worst
RP: particle
aboard about across along apart around aside at away back before behind
by crop down ever fast for forth from go high i.e. in into just later
low more off on open out over per pie raising start teeth that through
under unto up up-pp upon whole with you
TO: "to" as preposition or infinitive marker
to
UH: interjection
Goodbye Goody Gosh Wow Jeepers Jee-sus Hubba Hey Kee-reist Oops amen
huh howdy uh dammit whammo shucks heck anyways whodunnit honey golly
man baby diddle hush sonuvabitch ...
VB: verb, base form
ask assemble assess assign assume atone attention avoid bake balkanize
bank begin behold believe bend benefit bevel beware bless boil bomb
boost brace break bring broil brush build ...
VBD: verb, past tense
dipped pleaded swiped regummed soaked tidied convened halted registered
cushioned exacted snubbed strode aimed adopted belied figgered
speculated wore appreciated contemplated ...
VBG: verb, present participle or gerund
telegraphing stirring focusing angering judging stalling lactating
hankerin' alleging veering capping approaching traveling besieging
encrypting interrupting erasing wincing ...
VBN: verb, past participle
multihulled dilapidated aerosolized chaired languished panelized used
experimented flourished imitated reunifed factored condensed sheared
unsettled primed dubbed desired ...
VBP: verb, present tense, not 3rd person singular
predominate wrap resort sue twist spill cure lengthen brush terminate
appear tend stray glisten obtain comprise detest tease attract
emphasize mold postpone sever return wag ...
VBZ: verb, present tense, 3rd person singular
bases reconstructs marks mixes displeases seals carps weaves snatches
slumps stretches authorizes smolders pictures emerges stockpiles
seduces fizzes uses bolsters slaps speaks pleads ...
WDT: WH-determiner
that what whatever which whichever
WP: WH-pronoun
that what whatever whatsoever which who whom whosoever
WRB: Wh-adverb
how however whence whenever where whereby whereever wherein whereof why
-
2
-
4Missing:
$
,''
,(
,)
,,
,--
,.
,:
,FW
,NNPS
,SYM
,WP$
, [two backticks]. Seenltk.help.upenn_tagset()
.– user1544337Nov 22, 2017 at 20:32 -
8Thanks! This should have been chosen answer as this is much more comprehensive than just answering with, essentially, type something in your console to find out. May 24, 2018 at 2:29
-
2Also there is a list here: ling.upenn.edu/courses/Fall_2003/ling001/penn_treebank_pos.html– DavidApr 26, 2022 at 20:29
The book has a note how to find help on tag sets, e.g.:
nltk.help.upenn_tagset()
Others are probably similar. (Note: Maybe you first have to download tagsets
from the download helper's Models section for this)
-
5Now I'm curious: what is so mysterious about this? I have never really used NLTK, and finding that answer took me five minutes of googling and searching... Is it really that hidden? Jun 23, 2015 at 16:47
-
6I think it is not the question of how hidden, this also came up for me just trying to tag a single sentence, because I'm searching for the reason why does nltk tag my verbs as nouns and I didn't know how different tagsets can be used. This was helpful for this too, thanks!– PhoneboxJul 4, 2015 at 10:38
-
2@phipsgabler if others are like me, I had wrong expectations. I expected a lookup table/list/map, mapping the pos acronyms like
RB
to their meaning likeadverb
. (Here is an example; or see @Suzana's answer, which links the Penn Treebank Tag Set). But you're right, the builtinnltk.help.upenn_tagset('RB')
is helpful, and mentioned early in thenltk
book, Jan 28, 2020 at 1:15
The tag set depends on the corpus that was used to train the tagger.
The default tagger of nltk.pos_tag()
uses the Penn Treebank Tag Set.
In NLTK 2, you could check which tagger is the default tagger as follows:
import nltk
nltk.tag._POS_TAGGER
>>> 'taggers/maxent_treebank_pos_tagger/english.pickle'
That means that it's a Maximum Entropy tagger trained on the Treebank corpus.
nltk.tag._POS_TAGGER
does not exist anymore in NLTK 3 but the documentation states that the off-the-shelf tagger still uses the Penn Treebank tagset.
-
7
-
3This is an incomplete answer. Firstly,
nltk.tag._POS_TAGGER
doesn't execute and no specific instructions are provided about what to import. Also, finding out the tagger being used is half of the answer, the question is asking to get a list of all possible tags within the tagger Mar 16, 2016 at 13:51 -
3It's the corpus and not the tagger that determines the tag set. As soon as you know the corpus name, the complete tag set is only a Google search away.– SuzanaMar 16, 2016 at 17:01
The below can be useful to access a dict keyed by abbreviations:
>>> from nltk.data import load
>>> tagdict = load('help/tagsets/upenn_tagset.pickle')
>>> tagdict['NN'][0]
'noun, common, singular or mass'
>>> tagdict.keys()
['PRP$', 'VBG', 'VBD', '``', 'VBN', ',', "''", 'VBP', 'WDT', ...
-
4I prefer this approach than the accepted solution, because it's simpler and enumerates the possible values clearly Apr 27, 2016 at 22:29
-
1How are we sure that this is the tagset used by the tagger employed ? Afaik nltk can use several taggers. Oct 14, 2016 at 14:06
-
Agree with Hamman, this way has the added bonus of allowing you to look up the meanings programatically Mar 10, 2017 at 23:48
The reference is available at the official site
Copy and pasting from there:
- CC | Coordinating conjunction |
- CD | Cardinal number |
- DT | Determiner |
- EX | Existential there |
- FW | Foreign word |
- IN | Preposition or subordinating conjunction |
- JJ | Adjective |
- JJR | Adjective, comparative |
- JJS | Adjective, superlative |
- LS | List item marker |
- MD | Modal |
- NN | Noun, singular or mass |
- NNS | Noun, plural |
- NNP | Proper noun, singular |
- NNPS | Proper noun, plural |
- PDT | Predeterminer |
- POS | Possessive ending |
- PRP | Personal pronoun |
- PRP$ | Possessive pronoun |
- RB | Adverb |
- RBR | Adverb, comparative |
- RBS | Adverb, superlative |
- RP | Particle |
- SYM | Symbol |
- TO | to |
- UH | Interjection |
- 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 |
['LS', 'TO', 'VBN', "''", 'WP', 'UH', 'VBG', 'JJ', 'VBZ', '--', 'VBP', 'NN', 'DT', 'PRP', ':', 'WP$', 'NNPS', 'PRP$', 'WDT', '(', ')', '.', ',', '``', '$', 'RB', 'RBR', 'RBS', 'VBD', 'IN', 'FW', 'RP', 'JJR', 'JJS', 'PDT', 'MD', 'VB', 'WRB', 'NNP', 'EX', 'NNS', 'SYM', 'CC', 'CD', 'POS']
Based on Doug Shore's method but make it more copy-paste friendly
-
I accept this as a convenience contribution. I considered improving formatting, but that might go against the purpose of this post. Please you consider editing and using code formatting in combination with newlines to get both, nice formatting AND copy-paste-friendliness. stackoverflow.com/editing-help– YunnoschFeb 20, 2020 at 7:49
-
I considered doing this, but I think it would make it less convenient. Jun 3, 2020 at 1:01
You can download the list here: ftp://ftp.cis.upenn.edu/pub/treebank/doc/tagguide.ps.gz. It includes confusing parts of speech, capitalization, and other conventions. Also, wikipedia has an interesting section similar to this. Section: Part-of-speech tags used.
Just run this verbatim.
import nltk
nltk.download('tagsets')
nltk.help.upenn_tagset()
nltk.tag._POS_TAGGER
won't work. It will give AttributeError: module 'nltk.tag' has no attribute '_POS_TAGGER'. It's not available in NLTK 3 anymore.
Run the below code in Python to get information about all POS tags.
import nltk
nltk.help.upenn_tagset()
-
2