-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Training
ChatterBot has tools that simplify the process of training a bot instance. These tools range from simple utility methods that update relations of known statements, to a corpus of pre-loaded training data that you can use.
ChatterBot comes with a corpus data and utility module that makes it easy to quickly train your bot to communicate. To do so, simply specify the corpus data modules you want to use.
chatterbot.train(
"chatterbot.corpus.english.greetings",
"chatterbot.corpus.english.conversations"
)
For the training, process, you will need to pass in a list of statements where the order of each statement is based on it's placement in a given conversation.
For example, if you were to run bot of the following training calls, then the resulting chatterbot would respond to both statements of "Hi there!" and "Greetings!" by saying "Hello".
chatterbot = ChatBot("Training Example")
chatterbot.train([
"Hi there!",
"Hello",
])
chatterbot.train([
"Greetings!",
"Hello",
])
You can also provide longer lists of training conversations:
chatterbot.train([
"How are you?",
"I am good.",
"That is good to hear.",
"Thank you",
"You are welcome.",
])
This will establish each item in the list as a possible response to it's predecessor in the list.