pythonnlpnltkgoogle-colaboratory

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'


Solution

  • 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')