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

2

5

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'

Lynch answered 14/12, 2018 at 2:56 Comment(0)
D
13

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')
Decoteau answered 14/12, 2018 at 5:36 Comment(0)
M
0

to the people will see this error in the future, run this command line after installing NLTK library pip install --upgrade nltk it worked for me

Microscopium answered 7/9, 2024 at 13:18 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.