Harsh Verma
Harsh Verma

Reputation: 1

How to resolve stopwords error in Rake along with many more?

"D:\Python files\venv\Scripts\python.exe" "D:/Python files/main.py" Traceback (most recent call last): File "D:\Python files\venv\lib\site-packages\nltk\corpus\util.py", line 84, in __load root = nltk.data.find(f"{self.subdir}/{zip_name}") File "D:\Python files\venv\lib\site-packages\nltk\data.py", line 583, in find raise LookupError(resource_not_found) LookupError:


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

import nltk nltk.download('stopwords')

For more information see: https://www.nltk.org/data.html

Attempted to load corpora/stopwords.zip/stopwords/

Searched in: - 'C:\Users\Harsh/nltk_data' - 'D:\Python files\venv\nltk_data' - 'D:\Python files\venv\share\nltk_data' - 'D:\Python files\venv\lib\nltk_data' - 'C:\Users\Harsh\AppData\Roaming\nltk_data' - 'C:\nltk_data' - 'D:\nltk_data' - 'E:\nltk_data'


During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "D:\Python files\main.py", line 16, in r = Rake() File "D:\Python files\venv\lib\site-packages\rake_nltk\rake.py", line 84, in init self.stopwords = set(nltk.corpus.stopwords.words(language)) File "D:\Python files\venv\lib\site-packages\nltk\corpus\util.py", line 121, in getattr self.__load() File "D:\Python files\venv\lib\site-packages\nltk\corpus\util.py", line 86, in __load raise e File "D:\Python files\venv\lib\site-packages\nltk\corpus\util.py", line 81, in __load root = nltk.data.find(f"{self.subdir}/{self.__name}") File "D:\Python files\venv\lib\site-packages\nltk\data.py", line 583, in find raise LookupError(resource_not_found) LookupError:


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

import nltk nltk.download('stopwords')

For more information see: https://www.nltk.org/data.html

Attempted to load corpora/stopwords

Searched in: - 'C:\Users\Harsh/nltk_data' - 'D:\Python files\venv\nltk_data' - 'D:\Python files\venv\share\nltk_data' - 'D:\Python files\venv\lib\nltk_data' - 'C:\Users\Harsh\AppData\Roaming\nltk_data' - 'C:\nltk_data' - 'D:\nltk_data' - 'E:\nltk_data'


Process finished with exit code 1

tried cahnging code, reslving syntax errrors expecting solution

Upvotes: -2

Views: 61

Answers (1)

you will solve it by running this code in your python IDE

import nltk
import ssl

try:
    _create_unverified_https_context = ssl._create_unverified_context
except AttributeError:
    pass
else:
    ssl._create_default_https_context = _create_unverified_https_context

nltk.download()

after this, it should open a window which will allow you to select the nltk resources you want to use. It should be like this:enter image description here

Then you click on "Download" and you should be ready to go!

Upvotes: 0

Related Questions