DEV Community

Discussion on: Build your first ChatBot in 5 minutes

Collapse
 
kpspersonal profile image
kpspersonal • Edited

do pip install chatterbot-corpus
Then
Make the following changes to your code
remove the following lines
bot.set_trainer(ListTrainer)
bot.set_trainer(ChatterBotCorpusTrainer)
bot.train("chatterbot.corpus.english")

Add the following
trainer = ChatterBotCorpusTrainer(bot)
trainer.train('chatterbot.corpus.english')

Remove the following
training on english dataset
for files in os.listdir('./english/'):
data=open('./english/'+files,'r').readlines()
data=open('./english/'+files,'r').readlines()
trainer.train(data)
It should work now.