No module named sentiwordnet error python

1.5k Views Asked by At

I am trying to get sentiwordnet scores for a project in python and I find this code somewhere.

    import sentiwordnet
    from sentiwordnet import *
    swn_filename = 'C:\\Python27\\Lib\\SentiWordNet_3.0.0_20130122.txt'
    swn = SentiWordNetCorpusReader(swn_filename)

and so on... However, when I run it throws error "no module named sentiwordnet". I tried to pip install sentiwordnet thinking the module might be missing but that also threw an error. What to do?? Pls help.

1

There are 1 best solutions below

0
On

Check out the installation guide here: http://www.nltk.org/install.html

The class you want to use is documented here: http://www.nltk.org/api/nltk.corpus.reader.html#module-nltk.corpus.reader.sentiwordnet