OrionBot

Train Method

The train method of the Chatbot class is used to train the chatbot on new input and response pairs. Here’s how you can use it:

my_bot = Chatbot(name="MyBot")
my_bot.train("Hello", "Hi there!")

Parameters

The train method takes two parameters:

Example

Here’s an example of how to use the train method to train the chatbot on multiple input and response pairs:

my_bot = Chatbot(name="MyBot")

my_bot.train("Hello", "Hi there!")
my_bot.train("How are you?", "I'm doing well, thanks for asking.")
my_bot.train("What's your name?", "My name is MyBot.")

In the example above, we create a new Chatbot instance called my_bot and then train it on three different input and response pairs.

Notes

Table of Contents