This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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) | |
Happy Learning!!!
No comments:
Post a Comment