I am trying to start a project of sentiment analysis and I will use the stop words method. I made some research and I found that nltk have stopwords but when I execute the c
import nltk
nltk.download()
I tried from ubuntu terminal and I don't know why the GUI didn't show up according to tttthomasssss answer. So I followed the comment from KLDavenport and it worked. Here is the summary:
Open your terminal/command-line and type python then
>>> import nltk
.>>> nltk.download("stopwords")
This will store the stopwords corpus under the nltk_data. For my case it was /home/myusername/nltk_data/corpora/stopwords
.
If you need another corpus then visit nltk data and find the corpus with their ID. Then use the ID to download like we did for stopwords.
import nltk
nltk.download('stopwords')
from nltk.corpus import stopwords
STOPWORDS = set(stopwords.words('english'))
You don't seem to have the stopwords corpus on your computer.
You need to start the NLTK Downloader and download all the data you need.
Open a Python console and do the following:
>>> import nltk
>>> nltk.download()
showing info http://nltk.github.com/nltk_data/
In the GUI window that opens simply press the 'Download' button to download all corpora or go to the 'Corpora' tab and only download the ones you need/want.
import nltk
nltk.download()
Click on download button when gui prompted. It worked for me.(nltk.download('stopwords')
doesn't work for me)
If you want to manually install NLTK Corpus.
1) Go to http://www.nltk.org/nltk_data/ and download your desired NLTK Corpus file.
2) Now in a Python shell check the value of nltk.data.path
3) Choose one of the path that exists on your machine, and unzip the data files into the corpora sub directory inside.
4) Now you can import the data from nltk.corpos import stopwords
Reference: https://medium.com/@satorulogic/how-to-manually-download-a-nltk-corpus-f01569861da9