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

Viewed 33

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

import nltk
nltk.download('punkt')

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