check if a word is a noun python

Solutions on MaxInterview for check if a word is a noun python by the best coders in the world

showing results for - "check if a word is a noun python"
Millicent
25 Sep 2017
1from nltk.corpus import wordnet as wn
2words = ['amazing', 'interesting', 'love', 'great', 'nice']
3pos_all = dict()
4for w in words:
5    pos_l = set()
6    for tmp in wn.synsets(w):
7        if tmp.name().split('.')[0] == w:
8            pos_l.add(tmp.pos())
9    pos_all[w] = pos_l
10print pos_all