hyerimmy 2021. 2. 16. 22:46

🙈코드

#전처리를 위한 준비
stopWords = set(stopwords.words("english")) #영어불용어를 불러와 저장
lemma = WordNetLemmatizer() #표제어 추출 작업 제공하는 객체 생성

 

🙉오류내용

---------------------------------------------------------------------------
LookupError                               Traceback (most recent call last)
~\anaconda3\lib\site-packages\nltk\corpus\util.py in __load(self)
     82                 try:
---> 83                     root = nltk.data.find("{}/{}".format(self.subdir, zip_name))
     84                 except LookupError:

~\anaconda3\lib\site-packages\nltk\data.py in find(resource_name, paths)
    584     resource_not_found = "\n%s\n%s\n%s\n" % (sep, msg, sep)
--> 585     raise LookupError(resource_not_found)
    586 

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\\LG/nltk_data'
    - 'C:\\Users\\LG\\anaconda3\\nltk_data'
    - 'C:\\Users\\LG\\anaconda3\\share\\nltk_data'
    - 'C:\\Users\\LG\\anaconda3\\lib\\nltk_data'
    - 'C:\\Users\\LG\\AppData\\Roaming\\nltk_data'
    - 'C:\\nltk_data'
    - 'D:\\nltk_data'
    - 'E:\\nltk_data'
**********************************************************************


During handling of the above exception, another exception occurred:

LookupError                               Traceback (most recent call last)
<ipython-input-21-157624fd84de> in <module>
      1 #전처리를 위한 준비
----> 2 stopWords = set(stopwords.words("english")) #영어불용어를 불러와 저장
      3 lemma = WordNetLemmatizer() #표제어 추출 작업 제공하는 객체 생성

~\anaconda3\lib\site-packages\nltk\corpus\util.py in __getattr__(self, attr)
    118             raise AttributeError("LazyCorpusLoader object has no attribute '__bases__'")
    119 
--> 120         self.__load()
    121         # This looks circular, but its not, since __load() changes our
    122         # __class__ to something new:

~\anaconda3\lib\site-packages\nltk\corpus\util.py in __load(self)
     83                     root = nltk.data.find("{}/{}".format(self.subdir, zip_name))
     84                 except LookupError:
---> 85                     raise e
     86 
     87         # Load the corpus.

~\anaconda3\lib\site-packages\nltk\corpus\util.py in __load(self)
     78         else:
     79             try:
---> 80                 root = nltk.data.find("{}/{}".format(self.subdir, self.__name))
     81             except LookupError as e:
     82                 try:

~\anaconda3\lib\site-packages\nltk\data.py in find(resource_name, paths)
    583     sep = "*" * 70
    584     resource_not_found = "\n%s\n%s\n%s\n" % (sep, msg, sep)
--> 585     raise LookupError(resource_not_found)
    586 
    587 

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\\LG/nltk_data'
    - 'C:\\Users\\LG\\anaconda3\\nltk_data'
    - 'C:\\Users\\LG\\anaconda3\\share\\nltk_data'
    - 'C:\\Users\\LG\\anaconda3\\lib\\nltk_data'
    - 'C:\\Users\\LG\\AppData\\Roaming\\nltk_data'
    - 'C:\\nltk_data'
    - 'D:\\nltk_data'
    - 'E:\\nltk_data'
**********************************************************************​

 

🙊해결

- nltk 패키지 설치 코드를 입력

import nltk
nltk.download('stopwords')