1
2from chatterbot import ChatBot
3from chatterbot.trainers import ListTrainer
4
5bot = ChatBot('MyChatBot')
6bot.set_trainer(ListTrainer)
7
8conversation = open('chats.txt','r').readlines()
9
10bot.train(conversation)
11
12while True:
13 message = input('You:')
14 if message.strip()!= 'Bye':
15 reply = bot.get_response(message)
16 print('ChatBot:',reply)
17 if message.strip()=='Bye':
18 print('ChatBot:Bye')
19 break
20
21
1#This is MY chatbot with voice recognition and api voice responce
2# if you don't want it to be speech based then swap the speak and listen part
3# with input and print and you are good to go
4# Tis one is for beginners , you may use deep learning response algorithms if
5#you want to improve the experience.
6