I'm having trouble simply running this simple code here from lib ChatterBot:
from chatterbot import ChatBot
from chatterbot.trainers import ListTrainer
from chatterbot.trainers import ListTrainer
bot = ChatBot('Bot')
trainer = ListTrainer(bot)
trainer.train([
'Hi',
'Hello',
'I need roadmap for Competitive Programming',
'Just create an account on GFG and start',
'I have a query.',
'Please elaborate, your concern',
'How long it will take to become expert in Coding ?',
'It usually depends on the amount of practice.',
'Ok Thanks',
'No Problem! Have a Good Day!'
])
while True:
request=input('you :')
if request == 'OK' or request == 'ok':
print('Bot: bye')
break
else:
response=bot.get_response(request)
print('Bot:', response)
The problems presented are these:
Traceback (most recent call last):
File "C:\Users\User\Desktop\TESTE AI.py", line 5, in <module>
bot = ChatBot('Bot')
File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\site-packages\chatterbot\chatterbot.py", line 41, in __init__
self.storage = utils.initialize_class(storage_adapter, **kwargs)
File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\site-packages\chatterbot\utils.py", line 54, in initialize_class
return Class(*args, **kwargs)
File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\site-packages\chatterbot\storage\sql_storage.py", line 46, in __init__
if not self.engine.dialect.has_table(self.engine, 'Statement'):
File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\site-packages\sqlalchemy\dialects\sqlite\base.py", line 2016, in has_table
self._ensure_has_table_connection(connection)
File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\site-packages\sqlalchemy\engine\default.py", line 342, in _ensure_has_table_connection
raise exc.ArgumentError(
sqlalchemy.exc.ArgumentError: The argument passed to Dialect.has_table() should be a <class 'sqlalchemy.engine.base.Connection'>, got <class 'sqlalchemy.engine.base.Engine'>. Additionally, the Dialect.has_table() method is for internal dialect use only; please use ``inspect(some_engine).has_table(<tablename>>)`` for public API use.
Informations:
- Chatterbot==1.0.0 && 1.0.4 && 1.0.5 && 1.1.0
- Python==3.8.10
I thank you now!!