1

I read in the chatterbot documentation that chatterbot works by finding the closest matching input statement from a dataset to return an output statement. Is there a way to only match the input statements and return the matching input statement instead of the output?

For example:

from chatterbot import ChatBot
from chatterbot.trainers import ListTrainer

client = ChatBot("Alice")
trainer = ListTrainer(client)

trainer.train([
  "Hi, what is your name",
  "My name is chatterbot"
])

Instead of:
Hi, what is your name --> My name is chatterbot
I want:
what's your name --> Hi, what is your name

If this isn't possible with chatterbot, is there another way to do this?

desertnaut
  • 57,590
  • 26
  • 140
  • 166
walker
  • 444
  • 2
  • 12

1 Answers1

0

trainer.train([ "Hi, what is your name", "My name is chatterbot" ])

In this you are giving question and then the answer i.e. "Hi, what is your name" this line is the question that you will ask from chatterbot and "My name is chatterbot" is your answer. So just change the question answer to- trainer.train([ "Hi, what is your name", "Hi, what is your name" ])

  • I'm trying to do it so that when I use `bot.get_response('What's your name')` I get `Hi, what is your name` – walker Sep 16 '22 at 15:40