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?");
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')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With