Answers for "check if a word is a noun python"

0

check if a word is a noun python

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
Posted by: Guest on April-22-2020

Code answers related to "check if a word is a noun python"

Python Answers by Framework

Browse Popular Code Answers by Language