gunthercox / ChatterBot

ChatterBot is a machine learning, conversational dialog engine for creating chat bots
https://chatterbot.readthedocs.io
BSD 3-Clause "New" or "Revised" License
14.03k stars 4.44k forks source link

chatterbot always downloading nltk's package that already exist #1720

Open unknownsloth4 opened 5 years ago

unknownsloth4 commented 5 years ago

whenever i run this, i always got the following error

from chatterbot import ChatBot
chatbot = ChatBot ('Joe')

Traceback (most recent call last):
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python36\lib\site-packages\chatterbot\utils.py", line 108, in nltk_download_corpus
find(resource_path)
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python36\lib\site-packages\nltk\data.py", line 699, in find
raise LookupError(resource_not_found)
LookupError:

Resource �[93m�[0m not found.
Please use the NLTK Downloader to obtain the resource:

�[31m>>> import nltk

            nltk.download('')
            �[0m
            Attempted to load �[93mstopwords/�[0m

Searched in:
- 'C:\Users\ASUS/nltk_data'
- 'C:\Users\ASUS\AppData\Local\Programs\Python\Python36\nltk_data'
- 'C:\Users\ASUS\AppData\Local\Programs\Python\Python36\share\nltk_data'
- 'C:\Users\ASUS\AppData\Local\Programs\Python\Python36\lib\nltk_data'
- 'C:\Users\ASUS\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 "", line 1, in
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python36\lib\site-packages\chatterbot\chatterbot.py", line 58, in init
self.initialize()
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python36\lib\site-packages\chatterbot\chatterbot.py", line 80, in initialize
function()
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python36\lib\site-packages\chatterbot\utils.py", line 190, in download_nltk_stopwords
nltk_download_corpus('stopwords')
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python36\lib\site-packages\chatterbot\utils.py", line 110, in nltk_download_corpus
download(corpus_name)
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python36\lib\site-packages\nltk\downloader.py", line 787, in download
for msg in self.incr_download(info_or_id, download_dir, force):
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python36\lib\site-packages\nltk\downloader.py", line 636, in incr_download
info = self._info_or_id(info_or_id)
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python36\lib\site-packages\nltk\downloader.py", line 609, in _info_or_id
return self.info(info_or_id)
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python36\lib\site-packages\nltk\downloader.py", line 1019, in info
self._update_index()
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python36\lib\site-packages\nltk\downloader.py", line 962, in _update_index
ElementTree.parse(urlopen(self._url)).getroot()
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python36\lib\xml\etree\ElementTree.py", line 1196, in parse
tree.parse(source, parser)
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python36\lib\xml\etree\ElementTree.py", line 597, in parse
self._root = parser._parse_whole(source)
xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 1, column 0

its seems like chatterbot always downloading nltk's package that already exist. is there any way to solve this? i tried to fix the ntlk download issue, but its no go. please help

vkosuri commented 5 years ago

https://github.com/gunthercox/ChatterBot/issues/1618#issuecomment-464369042