标签: universal-pos-tag

如何使用带有 nltk.pos_tag() 函数的通用 POS 标签?

我有一个文本,我想找到“ADJs”、“PRONs”、“VERBs”、“NOUNs”等的数量。我知道有.pos_tag()函数,但它给了我不同的结果,我想要结果为“ADJ” ','PRON', '动词', '名词'。这是我的代码:

import nltk
from nltk.corpus import state_union, brown
from nltk.corpus import stopwords
from nltk import ne_chunk

from nltk.tokenize import PunktSentenceTokenizer
from nltk.tokenize import word_tokenize
from nltk.tokenize import RegexpTokenizer
from nltk.stem import WordNetLemmatizer 

from collections import Counter

sentence = "this is my sample text that I want to analyze with programming language"

# tokenizing text (make list with evey word)
sample_tokenization = word_tokenize(sample)
print("THIS IS TOKENIZED SAMPLE TEXT, LIST OF WORDS:\n\n", sample_tokenization)
print()

# tagging words …
Run Code Online (Sandbox Code Playgroud)

python nlp nltk pos-tagger universal-pos-tag

1
推荐指数
1
解决办法
1492
查看次数

标签 统计

nlp ×1

nltk ×1

pos-tagger ×1

python ×1

universal-pos-tag ×1