nltk的pos_tag

链接:python自然语言处理——NLTK——词性标签(pos_tag)

 

 

 主要是看不懂词性。

词性列表:

CC     coordinatingconjunction 并列连词
CD     cardinaldigit  纯数  基数
DT     determiner  限定词(置于名词前起限定作用,如 the、some、my 等)
EX     existentialthere (like:"there is"... think of it like "thereexists")   存在句;存现句
FW     foreignword  外来语;外来词;外文原词
IN     preposition/subordinating conjunction介词/从属连词;主从连词;从属连接词
JJ     adjective    'big'  形容词
JJR    adjective, comparative 'bigger' (形容词或副词的)比较级形式
JJS    adjective, superlative 'biggest'  (形容词或副词的)最高级
LS     listmarker  1)
MD     modal (could, will) 形态的,形式的 , 语气的;情态的
NN     noun, singular 'desk' 名词单数形式
NNS    nounplural  'desks'  名词复数形式
NNP    propernoun, singular     'Harrison' 专有名词
NNPS  proper noun, plural 'Americans'  专有名词复数形式
PDT    predeterminer      'all the kids'  前位限定词
POS    possessiveending  parent's   属有词  结束语
PRP    personalpronoun   I, he, she  人称代词
PRP$  possessive pronoun my, his, hers  物主代词
RB     adverb very, silently, 副词    非常  静静地
RBR    adverb,comparative better   (形容词或副词的)比较级形式
RBS    adverb,superlative best    (形容词或副词的)最高级
RP     particle     give up 小品词(与动词构成短语动词的副词或介词)
TO     to    go 'to' the store.
UH     interjection errrrrrrrm  感叹词;感叹语
VB     verb, baseform    take   动词
VBD    verb, pasttense   took   动词   过去时;过去式
VBG    verb,gerund/present participle taking 动词  动名词/现在分词
VBN    verb, pastparticiple     taken 动词  过去分词
VBP    verb,sing. present, non-3d     take 动词  现在
VBZ    verb, 3rdperson sing. present  takes   动词  第三人称
WDT    wh-determiner      which 限定词(置于名词前起限定作用,如 the、some、my 等)
WP     wh-pronoun   who, what 代词(代替名词或名词词组的单词)
WP$    possessivewh-pronoun     whose  所有格;属有词
WRB    wh-abverb    where, when 副词
(https://wenku.baidu.com/view/c63bec3b366baf1ffc4ffe4733687e21af45ffab.html)

使用代码:

def word_pos_tags(word_stopped):
    # 词性标注,返回以单词+词性标注为元组的list: pos_tags
    pos_tags = nltk.pos_tag(word_stopped)
    path_word_tokenize_stopped_pos_tag = \
        'H:\PythonCode\Browser\Precessing\words_atheism_word_tokenize_Stopped_postag.txt'
    # 存放词性标注处理结果的文本路径
    with open(path_word_tokenize_stopped_pos_tag, 'w', encoding='utf-8') as f:
        f.write(str(pos_tags))
    print('Pos_tags written.')
    return pos_tags

 

posted @ 2021-04-27 11:36  cai的一批  阅读(635)  评论(0编辑  收藏  举报