Kaggle - stopwords download - download false

Viewed 284

My kernel is NLP with disaster twitter. Kaggle notebook works in download stopwords and error code download stopwords. It's error code:

import nltk


nltk.download("stopwords")

[nltk_data] Error loading stopwords: <urlopen error [Errno -3]
[nltk_data]     Temporary failure in name resolution>
False
2 Answers

This error occurs if your kernel does not have internet turned on. You can turn the internet on in your settings

Solution 1 - Turn on kernel internet

  1. On the right side of your notebook, open Settings
  2. Switch Internet to 'On'. You may need to do additional verification for your account

KernelSettingsInternet

Solution 2 - Directly add the nltk_data

An easy way to resolve this without turning on internet on your kernel is to do the following:

  1. Select 'Add Data' in the top right of the notebook
  2. Search for nltk_data, click 'Add' button
  3. Update your code to include the following:
import nltk
from nltk.corpus import stopwords

I tried it and it worked for me.

As suggested in the comment you could try later.

Another option is to use the GUI.

Do

import nltk
nltk.download()

and the GUI should open where you can manually select what you want to download.

Related