from chatterbot import ChatBot
from chatterbot.trainers import ListTrainer
chatbot = ChatBot("BotBot")
trainer = ListTrainer(chatbot)
trainer.train([
"Hi","Hello",
"I wanted to know today's date","Today's date is 11 Dec 2020",
"Thank you for the information","Do you need any more assistance",
"No thank you","Thank you"])
while True:
request = input("You:")
if request=='Bye' or request =='bye':
print('Bot:Bye')
break
else:
response = chatbot.get_response(request)
print("Bot:",response)
train() function uses directed graph traversal while giving a response.