python nltk pos_tags词性标签说明

pos_tags标签说明

用法:

pos_tags = nltk.pos_tag(words)
words是独立的单词列表

举个栗子

处理一段英文文本(text),进行分词,删除停用词,词性识别。

import nltk
from nltk.tokenize import sent_tokenize, word_tokenize
from nltk.corpus import stopwords
from string import punctuation

text = 'Compatibility of systems of linear constraints over the set of natural numbers.'
# 分词
words_before = word_tokenize(text.lower())

# 删除停用词和标点符号
stopwords = set(stopwords.words('english') + list(punctuation))

words = []
for w in words_before:
    if w not in stopwords:
        words.append(w)

# 词性标注
pos_tags = nltk.pos_tag(words)
print(pos_tags)

输出

[('compatibility', 'NN'), ('systems', 'NNS'), ('linear', 'JJ'), ('constraints', 'NNS'), ('set', 'VBD'), ('natural', 'JJ'), ('numbers', 'NNS')]

标签说明:

标签原词含义举例
CCcoordinatingconjunction连词and, or,but, if, while,although
CDcardinaldigit数词twenty-four, fourth, 1991,14:24
DTdeterminer限定词the, a, some, most,every, no
EXexistentialthere存在量词there, there’s
FWforeignword外来词dolce, ersatz, esprit, quo,maitre
INpreposition/subordinating conjunction介词连词on, of,at, with,by,into, under
JJadjective形容词new,good, high, special, big, local
JJRadjective comparative形容词比较级bleaker braver breezier briefer brighter brisker
JJSadjective, superlative形容词最高级calmest cheapest choicest classiest cleanest clearest
LSlistmarker标记
MDmodal情态动词can cannot could couldn’t
NNnoun , singular名词year,home, costs, time, education
NNSnounplural名词复数undergraduates scotches
NNPpropernoun, singular专有名词Alison,Africa,April,Washington
NNPSproper noun, plural专有名词复数Americans Americas Amharas Amityvilles
PDTpredeterminer前限定词all both half many
POSpossessiveending所有格标记’ 's
PRPpersonalpronoun人称代词
PRP$possessive pronoun所有格her his mine my our ours
RBadverb副词occasionally unabatingly maddeningly
RBRadverb,comparative副词比较级further gloomier grander
RBSadverb,superlative副词最高级best biggest bluntest earliest
RPparticle虚词aboard about across along apart
SYM符号% & ’ ‘’ ‘’. ) )
TOtoto to
UHinterjection感叹词Goodbye Goody Gosh Wow
VBverb, baseform动词ask assemble assess
VBDverb, pasttense动词过去式dipped pleaded swiped
VBGverb,gerund/present participle动词现在分词telegraphing stirring focusing
VBNverb, pastparticiple动词过去分词multihulled dilapidated aerosolized
VBPverb,sing. present, non-3d动词现在式非第三人称时态predominate wrap resort sue
VBZverb, 3rdperson sing. present动词现在式第三人称时态bases reconstructs marks
WDTwh-determinerWh限定词who,which,when,what,where,how
WPwh-pronounWH代词that what whatever
WP$possessivewh-pronounWH代词所有格whose
WRBwh-abverbWH副词-
  • 0
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值