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