dipanjanS/text-analytics-with-python

Non functioning code in chapter 7: sentiwordnet example

ruddjm opened this issue · 1 comments

This is also on page 356.

from nltk.corpus import sentiwordnet as swn

good = swn.senti_synsets('good', 'n')[0]
Traceback (most recent call last):
File "", line 1, in
TypeError: 'filter' object is not subscriptable

Python 3 has changed things you can try:

good = list(swn.senti_synsets('good', 'n'))[0]