Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resource punkt not found. Please use the NLTK Downloader to obtain the resource: >>> import nltk >>> nltk.download('punkt')

Tags:

python

nltk

I have NLTK installed and it is giving me an error:

Resource punkt not found.
Please use the NLTK Downloader to obtain the resource:

import nltk
nltk.download('punkt')
For more information see: https://www.nltk.org/data.html

Attempted to load tokenizers/punkt/PY3/english.pickle

  Searched in:
    - '/Users/divyanshundley/nltk_data'
    - '/Library/Frameworks/Python.framework/Versions/3.10/nltk_data'
    - '/Library/Frameworks/Python.framework/Versions/3.10/share/nltk_data'
    - '/Library/Frameworks/Python.framework/Versions/3.10/lib/nltk_data'
    - '/usr/share/nltk_data'
    - '/usr/local/share/nltk_data'
    - '/usr/lib/nltk_data'
    - '/usr/local/lib/nltk_data'
    - ''
**********************************************************************

And my code is:

import nltk
nltk.download('punkt')

def tokenize(token):
    return nltk.word_tokenize(token);
tokenize("why is this not working?");

1 Answers

In addition to the packages mentioned in the other answers, I also had to add this one:

nltk.download('punkt_tab')

Other packages to download:

nltk.download('punkt')
nltk.download('wordnet')
nltk.download('omw-1.4')
like image 184
Carolina Goes Avatar answered Dec 12 '25 17:12

Carolina Goes



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!