chamkank / flask-chatterbot

Simple boilerplate for ChatterBot using Flask
377 stars 263 forks source link

error = english_bot.set_trainer(ChatterBotCorpusTrainer) AttributeError: 'ChatBot' object has no attribute 'set_trainer' #22

Open aspiringguru opened 5 years ago

aspiringguru commented 5 years ago

I'm seeing this problem as below. no changes from the git repo, git clone, then pip install -r requirements.txt

it looks like a problem within the chatterbot git repo, which is weird.

reported similar problem on the chatterbot git repo yesterday, hoping someone might spot what is going on or replicate my problem.

my current platform: windows 10, have also seen this problem on ubuntu 16.04

checking the package versions pip freeze | grep atter ChatterBot==1.0.2 chatterbot-corpus==1.2.0

python app.py [nltk_data] Downloading package averaged_perceptron_tagger to [nltk_data] C:\Users\Matthew\AppData\Roaming\nltk_data... [nltk_data] Package averaged_perceptron_tagger is already up-to- [nltk_data] date! [nltk_data] Downloading package punkt to [nltk_data] C:\Users\Matthew\AppData\Roaming\nltk_data... [nltk_data] Package punkt is already up-to-date! [nltk_data] Downloading package stopwords to [nltk_data] C:\Users\Matthew\AppData\Roaming\nltk_data... [nltk_data] Package stopwords is already up-to-date! Traceback (most recent call last): File "app.py", line 9, in english_bot.set_trainer(ChatterBotCorpusTrainer) AttributeError: 'ChatBot' object has no attribute 'set_trainer'

fanntom commented 5 years ago

I'm getting the same issue on a fresh installation.

imbrianp@ubuntu:~/flask-chatterbot$ python3 app.py [nltk_data] Downloading package averaged_perceptron_tagger to [nltk_data] /home/imbrianp/nltk_data... [nltk_data] Package averaged_perceptron_tagger is already up-to- [nltk_data] date! [nltk_data] Downloading package punkt to /home/imbrianp/nltk_data... [nltk_data] Package punkt is already up-to-date! [nltk_data] Downloading package stopwords to [nltk_data] /home/imbrianp/nltk_data... [nltk_data] Package stopwords is already up-to-date! Traceback (most recent call last): File "app.py", line 9, in english_bot.set_trainer(ChatterBotCorpusTrainer) AttributeError: 'ChatBot' object has no attribute 'set_trainer'

aspiringguru commented 5 years ago

Can you follow-up on my issue on the chatterbot git repo. The author indicated he couldn't identify the problem.

ciberflaite commented 5 years ago

Try with

trainer = ChatterBotCorpusTrainer(chatbot)
trainer.train("chatterbot.corpus.english")
fzhcary commented 5 years ago

I fixed this issue by change requirements.txt: ChatterBot==0.7.1

Endogen commented 5 years ago

I fixed this issue by change requirements.txt: ChatterBot==0.7.1

That doesn't work for me. I'm getting an error while installing that dependency

Try with

trainer = ChatterBotCorpusTrainer(chatbot)
trainer.train("chatterbot.corpus.english")

That works fine 👍

RishabGuggali commented 4 years ago

I am getting these when i run it. please help me

C:\Users\rgugg\PycharmProjects\flask-chatterbot\venv\Scripts\python.exe C:/Users/rgugg/PycharmProjects/flask-chatterbot/app.py Traceback (most recent call last): File "C:/Users/rgugg/PycharmProjects/flask-chatterbot/app.py", line 2, in from chatterbot import ChatBot File "C:\Users\rgugg\PycharmProjects\flask-chatterbot\venv\lib\site-packages\chatterbot__init.py", line 4, in from .chatterbot import ChatBot File "C:\Users\rgugg\PycharmProjects\flask-chatterbot\venv\lib\site-packages\chatterbot\chatterbot.py", line 3, in from chatterbot.logic import LogicAdapter File "C:\Users\rgugg\PycharmProjects\flask-chatterbot\venv\lib\site-packages\chatterbot\logic\init__.py", line 1, in from chatterbot.logic.logic_adapter import LogicAdapter File "C:\Users\rgugg\PycharmProjects\flask-chatterbot\venv\lib\site-packages\chatterbot\logic\logic_adapter.py", line 3, in from chatterbot.search import IndexedTextSearch File "C:\Users\rgugg\PycharmProjects\flask-chatterbot\venv\lib\site-packages\chatterbot\search.py", line 1, in from chatterbot.conversation import Statement File "C:\Users\rgugg\PycharmProjects\flask-chatterbot\venv\lib\site-packages\chatterbot\conversation.py", line 1, in from pytz import UTC ModuleNotFoundError: No module named 'pytz'

Process finished with exit code 1