📌  相关文章
📜  检查单词是否为名词 python 代码示例

📅  最后修改于: 2022-03-11 14:45:17.026000             🧑  作者: Mango

代码示例1
from nltk.corpus import wordnet as wn
words = ['amazing', 'interesting', 'love', 'great', 'nice']
pos_all = dict()
for w in words:
    pos_l = set()
    for tmp in wn.synsets(w):
        if tmp.name().split('.')[0] == w:
            pos_l.add(tmp.pos())
    pos_all[w] = pos_l
print pos_all