I have NLTK installed and it is going me 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
JavaScript
x
7
1
import nltk
2
nltk.download('punkt')
3
4
def tokenize(token):
5
return nltk.word_tokenize(token);
6
tokenize("why is this not working?");
7
Advertisement
Answer
Please download the below also. This will resolve your issue:
JavaScript
1
4
1
*nltk.download('punkt')
2
nltk.download('wordnet')
3
nltk.download('omw-1.4'*
4
)