"No one is harder on a talented person than the person themselves" - Linda Wilkinson ; "Trust your guts and don't follow the herd" ; "Validate direction not destination" ;

October 29, 2019

Day #291 - Working with chatterbot - Windows 10

#pip install --ignore-installed PyYAML
#pip install chatterbot
#pip install chatterbot-corpus
from chatterbot import ChatBot
from chatterbot.trainers import ChatterBotCorpusTrainer
from chatterbot.trainers import ListTrainer
welcomebot = ChatBot("Charlie")
#The current training method takes a list of statements that represent a conversation
initialconversation = [
"Hello",
"Hi there!",
"How are you doing?",
"I'm doing great.",
"That is good to hear",
"Thank you.",
"You're welcome."
]
welcomebottrainer = ListTrainer(welcomebot)
welcomebottrainer.train(initialconversation)
#The program selects the closest matching response by searching for the closest matching known statement that matches the input
response = welcomebot.get_response("Hi there")
print(response)
response = welcomebot.get_response("Hello")
print(response)
coursebot = ChatBot("Charlie")
coursebottrainer = ListTrainer(coursebot)
querycourses = [
"Share courses",
"We offer courses in AI, ML, Devops, Big Data",
"Great ",
"Share me AI Details",
"It has machine learning basics to advanced models",
"What about big data",
"hadoop, streaming tools and kafka",
"What about Devops",
"Docker, Kubernetics"
]
coursebottrainer.train(querycourses)
response = welcomebot.get_response("Share courses")
print(response)
response = welcomebot.get_response("Share me AI Details")
print(response)
paymentbot = ChatBot("Charlie")
paymentbottrainer = ListTrainer(paymentbot)
feescourses = [
"Devops Fees",
"Online 15K, Offline 10K",
"AI Feeds ",
"Online 25K, Offline 10K",
"Big Data Fees",
"Online 35K, Offline 10K",
]
paymentbottrainer.train(feescourses)
response = paymentbot.get_response("Devops Fees")
print(response)
response = paymentbot.get_response("Big Data Fees")
print(response)
view raw chattberbot.py hosted with ❤ by GitHub

Happy Learning!!!

No comments: