什么是 NLTK 所有可能的贴标签?

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

136171 次浏览

这本书 有一个关于如何在标签集中找到帮助的注释,例如:

nltk.help.upenn_tagset()

其他的可能也是类似的(注意: 也许您首先必须从下载助手的 模特部分下载 tagsets)

标记集取决于用于训练标记者的语料库。 nltk.pos_tag()的默认标记使用 宾夕法尼亚州立大学树木银行

在 NLTK2中,您可以检查哪个标签是默认的标签,如下所示:

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

也就是说这是一个在树木库中训练出来的最大熵标签。

在 NLTK3中不再存在 nltk.tag._POS_TAGGER,但是现成的标签仍然使用 Penn Treebank 标签集的 文件上说

下面的内容可以帮助您访问由缩写键入的字典:

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

为了节省一些人的时间,下面是我从一个小型语料库中提取的列表。我不知道它是否完整,但它应该有大部分(如果不是全部)的帮助定义 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

存在主义

there

IN : 介词或连词,从属

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

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

形容词,比较

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

形容词,最高级

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

名词,普通的,单数的或质量的

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

名词,专有名词,单数

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

名词,通用,复数

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

代词,人称

hers herself him himself hisself it itself me myself one oneself ours
ourselves ownself self she thee theirs them themselves they thou thy us

代词,所有格

her his mine my our ours their thy your

副词

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

副词,比较

further gloomier grander graver greater grimmer harder harsher
healthier heavier higher however larger later leaner lengthier less-
perfectly lesser lonelier longer louder lower more ...

副词,最高级

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

反相强: 粒子

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

动词,过去式

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

动词,现在分词或动名词

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

动词,过去分词

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

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

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

动词,现在时,第三人称单数

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

该参考文献可在 官方网站上获得

复制粘贴:

  • 协调连接
  • 基数
  • 决定者
  • 存在主义
  • 外来词
  • 介词或从属连词
  • 形容词
  • 形容词,比较词
  • 形容词,最高级
  • 列表项目标记
  • MD | Modal |
  • 名词,单数或质量
  • 名词,复数
  • 专有名词,单数
  • 专有名词,复数
  • 预决定因素
  • 占有式结尾
  • 人称代词
  • 所有格代词
  • 副词
  • 副词,比较
  • 副词,最高级
  • 粒子
  • SYM | 符号 |
  • 来自
  • 感叹词
  • 动词,基本形式
  • 动词,过去式
  • 动词、动名词或现在分词
  • 动词,过去分词
  • 动词,非第三人称单数现在
  • 动词,第三人称单数现在
  • WDT | wh- 限定词 |
  • 代词
  • 所有格 w- 代词
  • WRB | wh- 副词 |

你可以在这里下载列表: Ftp://ftp.cis.upenn.edu/pub/treebank/doc/tagguide.ps.gz。它包括语言的混淆部分、大写和其他惯例。此外,维基百科也有一个类似的有趣部分。节: 使用的词性标记。

一字不差地念出来。

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

nltk.tag._POS_TAGGER将不工作。它将给 AttributeError: 模块‘ nltk.tag’没有属性‘ _ POS _ TAGGER’。它不再在 NLTK3中可用。

['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 的方法,但使其更加便于复制粘贴

在 python 中运行以下代码以获取有关所有 pos 标记的信息。

import nltk
nltk.help.upenn_tagset()