I am getting this problem . my python code is
for i,j in nltk.pos_tag(words):
print i,j
if 'JJ' in j:
pj=(list(swn.senti_synsets(i,'a'))[0]).pos_score()
print "pj:" ,pj
elif 'RB' in j:
pr =(list(swn.senti_synsets(i,'r'))[0]).pos_score()
print "pr:" ,pr
elif 'NN' in j:
pn =(list(swn.senti_synsets(i,'n'))[0]).pos_score()
print "pn:" ,pn
elif 'VB' in j:
pv =(list(swn.senti_synsets(i,'v'))[0]).pos_score()
print "pv:" ,pv
where "words" is a list of words containing adjective , adverb , noun etc..
words=['good','only','excellent','really'.........] nearly 300 such words. when i run this code it works for first 2 words .that is positive score of good and only will b displayed. but when it goes to word "excellent " there is this error..
output:
good JJ
pj: 0.75
only RB
pr: 0.0
excellent JJ
Traceback (most recent call last):
File "C:\Python27\mat to file.py", line 39, in <module>
pj+=(swn.senti_synsets(i,'a')[0]).pos_score()
IndexError: list index out of range
please help !!!!