Quick Start Guide¶
The first thing you’ll need to do to get started is install ChatterBot.
pip install chatterbot
See Installation for options for alternative installation methods.
Create a new chat bot¶
from chatterbot import ChatBot
chatbot = ChatBot("Ron Obvious")
Note
The only required parameter for the ChatBot is a name. This can be anything you want.
Training your ChatBot¶
After creating a new ChatterBot instance it is also possible to train the bot. Training is a good way to ensure that the bot starts off with knowledge about specific responses. The current training method takes a list of statements that represent a conversation. Additional notes on training can be found in the Training documentation.
Note
Training is not required but it is recommended.
from chatterbot.trainers import ListTrainer
conversation = [
"Hello",
"Hi there!",
"How are you doing?",
"I'm doing great.",
"That is good to hear",
"Thank you.",
"You're welcome."
]
trainer = ListTrainer(chatbot)
trainer.train(conversation)
Get a response¶
response = chatbot.get_response("Good morning!")
print(response)