Open artptz opened 4 months ago
I have the same error
Same error.. Wondering if there's something I could be missing... I'm trying to run the example from a virtual environment though......
Noticed it's been a while (about 6 months before time of writing -> https://github.com/sloria/TextBlob/commit/c27324d9986fdfa56d4337c3bce952f2b057ceb4) since there were changes to the repo and I could roughly say that this project isn't really maintained anymore or the author(s) / contributor(s) haven't exactly had the time to address some issues as of late.
Still hope to hear from them whenever someone's available.
sample_text = "I love data science and machine learning. I love coding. I love data science and coding."
TextBlob(sample_text).ngrams(3) # 3-gram
LookupError Traceback (most recent call last)
File c:\Users\tokel\anaconda3\Lib\site-packages\textblob\decorators.py:35, in requires_nltk_corpus.<locals>.decorated(*args, **kwargs)
[34](file:///C:/Users/tokel/anaconda3/Lib/site-packages/textblob/decorators.py:34) try:
---> [35](file:///C:/Users/tokel/anaconda3/Lib/site-packages/textblob/decorators.py:35) return func(*args, **kwargs)
[36](file:///C:/Users/tokel/anaconda3/Lib/site-packages/textblob/decorators.py:36) except LookupError as error:
File c:\Users\tokel\anaconda3\Lib\site-packages\textblob\tokenizers.py:59, in SentenceTokenizer.tokenize(self, text)
[58](file:///C:/Users/tokel/anaconda3/Lib/site-packages/textblob/tokenizers.py:58) """Return a list of sentences."""
---> [59](file:///C:/Users/tokel/anaconda3/Lib/site-packages/textblob/tokenizers.py:59) return nltk.tokenize.sent_tokenize(text)
File c:\Users\tokel\anaconda3\Lib\site-packages\nltk\tokenize\__init__.py:119, in sent_tokenize(text, language)
[110](file:///C:/Users/tokel/anaconda3/Lib/site-packages/nltk/tokenize/__init__.py:110) """
[111](file:///C:/Users/tokel/anaconda3/Lib/site-packages/nltk/tokenize/__init__.py:111) Return a sentence-tokenized copy of *text*,
[112](file:///C:/Users/tokel/anaconda3/Lib/site-packages/nltk/tokenize/__init__.py:112) using NLTK's recommended sentence tokenizer
(...)
[117](file:///C:/Users/tokel/anaconda3/Lib/site-packages/nltk/tokenize/__init__.py:117) :param language: the model name in the Punkt corpus
[118](file:///C:/Users/tokel/anaconda3/Lib/site-packages/nltk/tokenize/__init__.py:118) """
--> [119](file:///C:/Users/tokel/anaconda3/Lib/site-packages/nltk/tokenize/__init__.py:119) tokenizer = _get_punkt_tokenizer(language)
[120](file:///C:/Users/tokel/anaconda3/Lib/site-packages/nltk/tokenize/__init__.py:120) return tokenizer.tokenize(text)
File c:\Users\tokel\anaconda3\Lib\site-packages\nltk\tokenize\__init__.py:105, in _get_punkt_tokenizer(language)
[98](file:///C:/Users/tokel/anaconda3/Lib/site-packages/nltk/tokenize/__init__.py:98) """
[99](file:///C:/Users/tokel/anaconda3/Lib/site-packages/nltk/tokenize/__init__.py:99) A constructor for the PunktTokenizer that utilizes
[100](file:///C:/Users/tokel/anaconda3/Lib/site-packages/nltk/tokenize/__init__.py:100) a lru cache for performance.
...
python -m textblob.download_corpora
or use the NLTK downloader to download the missing data: http://nltk.org/data.html
If this doesn't fix the problem, file an issue at https://github.com/sloria/TextBlob/issues.
I ran python -m textblob.download_corpora but still received the above error