NLTK可能有哪些pos标签?


140

如何找到包含自然语言工具包(nltk)使用的所有可能pos标记的列表?

Answers:


151

这本书有一个注释,说明如何在标签集上寻求帮助,例如:

nltk.help.upenn_tagset()

其他人可能相似。(注意:也许您首先需要为此tagsets从下载助手的“ 模型”部分进行下载)


3
现在我很好奇:这有什么神秘之处?我从来没有真正使用过NLTK,找到这个答案花了我五分钟的时间进行谷歌搜索和搜索……它真的那么隐藏吗?
phipsgabler 2015年

5
我认为这不是隐藏的问题,这也是我试图标记单个句子的原因,因为我正在寻找为什么nltk将我的动词标记为名词的原因,而我不知道标记集有何不同可以使用。这也对此有所帮助,谢谢!
2015年

2
@phipsgabler如果别人像我一样,我有错误的期望。我期望有一个查询表/列表/映射,将pos的首字母缩写映射RB到它们的含义,例如adverb。(这是一个示例;或者参见@Suzana的答案,该答案链接了Penn Treebank标签集)。但您说对了,内建nltk.help.upenn_tagset('RB')函数很有帮助,并且在nltk书中早先提到过,
Red Pea

137

为了节省一些时间,这是我从一个小型语料库中提取的列表。我不知道它是否完整,但是它应该具有upenn_tagset中的大多数(如果不是全部)帮助定义...

CC:结合,协调

& 'n and both but either et for less minus neither nor or plus so
therefore times v. versus vs. whether yet

CD:数字,基数

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:确定者

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:存在存在

there

IN:介词或连词,从属

astride among uppon 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:形容词或数字,序数

third ill-mannered pre-war regrettable oiled calamitous first separable
ectoplasmic battery-powered participatory fourth still-to-be-named
multilingual multi-disciplinary ...

JJR:形容词,比较

bleaker braver breezier briefer brighter brisker broader bumper busier
calmer cheaper choosier cleaner clearer closer colder commoner costlier
cozier creamier crunchier cuter ...

JJS:形容词,最高级

calmest cheapest choicest classiest cleanest clearest closest commonest
corniest costliest crassest creepiest crudest cutest darkest deadliest
dearest deepest densest dinkiest ...

LS:列表项标记

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:模态辅助

can cannot could couldn't dare may might must need ought shall should
shouldn't will would

NN:名词,普通,单数或质量

common-carrier cabbage knuckle-duster Casino afghan shed thermostat
investment slide humour falloff slick wind hyena override subhumanity
machinist ...

NNP:名词,专有名词,单数

Motown Venneboerger Czestochwa Ranzer Conchita Trumplane Christos
Oceanside Escobar Kreisler Sawyer Cougar Yvette Ervin ODI Darryl CTCA
Shannon A.K.C. Meltex Liverpool ...

NNS:名词,常见,复数

undergraduates scotches bric-a-brac products bodyguards facets coasts
divestitures storehouses designs clubs fragrances averages
subjectivists apprehensions muses factory-jobs ...

PDT:预定项

all both half many quite such sure this

POS:遗传标记

' 's

PRP:代词,个人

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 $:代词,所有格

her his mine my our ours their thy your

RB:副词

occasionally unabatingly maddeningly adventurously professedly
stirringly prominently technologically magisterially predominately
swiftly fiscally pitilessly ...

RBR:副词,比较

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:副词,最高级

best biggest bluntest earliest farthest first furthest hardest
heartiest highest largest least less most nearest second tightest worst

RP:颗粒

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”作为介词或不定式标记

to

UH:感叹词

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:动词,基本形式

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:动词,过去时

dipped pleaded swiped regummed soaked tidied convened halted registered
cushioned exacted snubbed strode aimed adopted belied figgered
speculated wore appreciated contemplated ...

VBG:动词,现在分词或动名词

telegraphing stirring focusing angering judging stalling lactating
hankerin' alleging veering capping approaching traveling besieging
encrypting interrupting erasing wincing ...

VBN:动词,过去分词

multihulled dilapidated aerosolized chaired languished panelized used
experimented flourished imitated reunifed factored condensed sheared
unsettled primed dubbed desired ...

VBP:动词,现在时,不是第三人称单数

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:动词,现在时,第三人称单数

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决定因素

that what whatever which whichever

WP:WH代词

that what whatever whatsoever which who whom whosoever

WRB:Wh-副词

how however whence whenever where whereby whereever wherein whereof why

2
@PALEN缺少什么?
binarymax '17年

2
丢失:$''(),--.:FWNNPSSYMWP$,[2个反引号。请参阅nltk.help.upenn_tagset()

6
谢谢!应该选择此答案,因为它比仅在控制台中键入内容来查找
slartibartfast

63

标签集取决于用于训练标签手的语料库。的默认标记器nltk.pos_tag()使用Penn树库标记集

在NLTK 2中,可以检查哪个标记器是默认标记器,如下所示:

import nltk
nltk.tag._POS_TAGGER
>>> 'taggers/maxent_treebank_pos_tagger/english.pickle'

这意味着它是在树库语料库上训练的最大熵标记器。

nltk.tag._POS_TAGGERNLTK 3中已不存在这种标记,但是文档指出,现成的标记器仍使用Penn Treebank标签集。


6
谢谢,imo,这个答案比公认的答案有用得多。
戴尔2014年

3
这是一个不完整的答案。首先,nltk.tag._POS_TAGGER不执行,也没有提供有关导入内容的特定说明。此外,找出正在使用的恶搞是一半的答案,目前的问题是要求得到恶搞内的所有可能的标签的列表
哈曼萨穆埃尔

3
决定标记集的是语料库,而不是标记器。一旦您知道了语料库名称,完整的标签集就只需要Google搜索即可。
Suzana

34

以下内容对于访问以缩写键键入的字典非常有用:

>>> 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', ...

2
我更喜欢这种方法,而不是公认的解决方案,因为它更简单并且清楚地枚举了可能的值
Hamman Samuel 2016年

1
我们如何确定这是所使用的标记器使用的标记集?Afaik nltk可以使用多个标记器。
Nikana Reklawyks

同意Hamman的意见,这种方式具有额外的好处,允许您以编程方式查找含义
datavoredan 2017年

28

该参考可在官方网站上找到

从那里复制和粘贴:

  • CC | 协调连词|
  • CD | 基数|
  • DT | 确定者|
  • EX | 生存 |
  • FW | 外来词|
  • IN | 介词或从属连词|
  • JJ | 形容词|
  • JJR | 形容词,比较
  • JJS | 形容词,最高级
  • LS | 清单项目标记|
  • MD | 模态|
  • NN | 奇异或名词
  • NNS | 名词,复数|
  • NNP | 专有名词,单数|
  • NNPS | 专有名词,复数|
  • PDT | 预定器|
  • POS | 可能的结局|
  • PRP | 人称代词|
  • PRP $ | 所有格代词|
  • RB | 副词|
  • RBR | 比较副词|
  • 苏格兰皇家银行 最高级副词|
  • RP | 颗粒|
  • SYM | 符号
  • 至| |
  • UH | 感叹词|
  • VB | 动词,基础形式|
  • VBD | 动词,过去时|
  • VBG | 动词,动名词或现在分词|
  • VBN | 动词,过去分词|
  • VBP | 动词,非第三人称单数形式的礼物|
  • VBZ | 动词,第三人称单数形式的礼物|
  • 看门狗| Wh决定子|
  • WP | Wh代词|
  • WP $ | 所有制Wh代词|
  • WRB | Wh-副词|


1
['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']

基于Doug Shore的方法,但使其更易于复制粘贴


我接受此作为便利性贡献。我考虑过改进格式,但这可能与本文的目的背道而驰。请考虑编辑并结合使用换行符和新的换行符来获得良好的格式化和复制粘贴的友好性。stackoverflow.com/editing-help
Yunnosch

我考虑过这样做,但我认为这样做会不太方便。
蓬松Ribbit

0

只需逐字运行即可。

import nltk
nltk.download('tagsets')
nltk.help.upenn_tagset()

nltk.tag._POS_TAGGER将无法正常工作。它将给出AttributeError:模块'nltk.tag'没有属性'_POS_TAGGER'。NLTK 3中不再提供该功能。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.