Чатбот Питон
#install the module:
# pip install chatterbot
# Import "chatbot" from
# chatterbot package.
from chatterbot import ChatBot
# Inorder to train our bot, we have
# to import a trainer package
# "ChatterBotCorpusTrainer"
from chatterbot.trainers import ChatterBotCorpusTrainer
# Give a name to the chatbot “chat bot”
# and assign a trainer component.
chatbot=ChatBot('chat bot')
# Create a new trainer for the chatbot
trainer = ChatterBotCorpusTrainer(chatbot)
# Now let us train our bot with multiple corpus
trainer.train("chatterbot.corpus.english.greetings",
"chatterbot.corpus.english.conversations" )
response = chatbot.get_response('What is your Number')
print(response)
response = chatbot.get_response('Who are you?')
print(response)
ykk