Search code examples
pythonnlpkagglestop-words

Kaggle - stopwords download - download false


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

Solution

  • 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