Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No such file or directory 'nltk_data/corpora/stopwords/English' when using colab

First of all I am using Google colab for the work and I have downloaded nltk stopwords for English with following:

nltk.download('stopwords')

The download was successful

[nltk_data] Downloading package stopwords to /root/nltk_data...

but when I run stop = stopwords.words('English')

I am getting OSError: No such file or directory: '/root/nltk_data/corpora/stopwords/English'

like image 421
john Avatar asked Dec 14 '18 02:12

john


1 Answers

TL;DR

The English should be in lowercase =)

See: https://colab.research.google.com/drive/1tNt0Ifom-h4OnFBBZpLndYCEPDU598jE

In Code

# Downloads the data.
import nltk
nltk.download('stopwords')


# Using the stopwords.
from nltk.corpus import stopwords

# Initialize the stopwords
stoplist = stopwords.words('english')
like image 165
alvas Avatar answered Sep 30 '22 13:09

alvas