from chatterbot import ChatBot
from chatterbot.trainers import ListTrainer
import os
bot = ChatBot('Bot')
bot.set_trainer(ListTrainer)
for files in os.listdir('D:/Anaconda3/Lib/site-packages/chatterbot_corpus/data/english'):
data = open('D:/Anaconda3/Lib/site-packages/chatterbot_corpus/data/english' + files, 'r').readlines()
bot.train(data)
while True:
message = input('You')
if message.strip() != 'Bye':
reply = bot.get_response(message)
print('ChatBot :', reply)
if message.strip() == 'Bye':
print('ChatBot : Bye')
break
我收到一个错误:
回溯(最近一次通话最后):文件“C:\Users\nakulmagotra\Desktop\chatbot_train.py”,第 1 行,从 chatterbot 导入 ChatBot ModuleNotFoundError:没有名为“chatterbot”的模块
我完全是 Chatterbot 的菜鸟。谢谢。