0
I’m trying to create a Python Bot:
#-*- coding: utf-8 -*-
from chatterbot.trainer import ListTrainer # trainador
from chatterbot import ChatBot # chatbot
import os
bot = ChatBot('Teste')
bot.set_trainer(ListTrainer)
for arq in os.listdir('arq'):
chats = open('arq/' + arq, 'r').readlines()
bot.train(chats)
while True:
resq = input('Você: ')
resp = bot.get_response(resq)
print('Bot: '+resp)
The message always appears:
Traceback (most recent call last):
File "C:/Users/danie/Desktop/chatBot/main.py", line 3, in <module>
from chatterbot.trainer import ListTrainer # trainador
File "C:\Program Files\Python36\lib\site-packages\chatterbot\__init__.py", line 4, in <module>
from .chatterbot import ChatBot
File "C:\Program Files\Python36\lib\site-packages\chatterbot\chatterbot.py", line 2, in <module>
from chatterbot.storage import StorageAdapter
File "C:\Program Files\Python36\lib\site-packages\chatterbot\storage\__init__.py", line 1, in <module>
from chatterbot.storage.storage_adapter import StorageAdapter
File "C:\Program Files\Python36\lib\site-packages\chatterbot\storage\storage_adapter.py", line 3, in <module>
from chatterbot.tagging import PosHypernymTagger
File "C:\Program Files\Python36\lib\site-packages\chatterbot\tagging.py", line 4, in <module>
from chatterbot.tokenizers import get_sentence_tokenizer
File "C:\Program Files\Python36\lib\site-packages\chatterbot\tokenizers.py", line 4, in <module>
from chatterbot.corpus import load_corpus, list_corpus_files
File "C:\Program Files\Python36\lib\site-packages\chatterbot\corpus.py", line 5, in <module>
from chatterbot_corpus.corpus import DATA_DIRECTORY
ModuleNotFoundError: No module named 'chatterbot_corpus'
Rearrange your question, post the full code and use the code markings on them for better viewing.
– user148754
Although the question is also unresolved, it is a possible duplicate of https://answall.com/questions/382386/m%C3%b3dulo-chatterbot-corpus-n%C3%a3o-found-ap%C3%b3s-install-chatterbot. It seems that the only website I’ve seen anyone leave happy with the result was on Github
– Breno
Different version of chatterbot... set_trainer() doesn’t even exist anymore I guess..
– FourZeroFive