Answers Updating
See original GitHub issueHi there, previously I faced a problem of updating the ChatterBot answers when its could not find the right one for a given question, my chatterbot was trained using data from the ChatterBot dialog corpus .
Then I decide to create a chatterbot database from scratch by creating empty database and inserting the question and the the answer one by one using the example “learning_new_response.py”.
the application works like this: type something to begin … me: hi chatterbot: Is “hi” a coherent response to “hi”? me: no chatterbot: please input the correct one me: Hello Dear! chatterbot: Responses added to bot! … and so on until I enter, let say 5 questions and answers. Then if I choose a pre-definde question it will choose a wrong answer. for example if I write “hi” the chatterbot will respond : Is “I am good thank you.” a coherent response to “hi”? I wondering what is going wrong here! ?
by the way, if I open the created database I can find all the questions with the right answers but I don’t know why it chooses a different answer even when I use the BestMatch as logic adapter.
bellow is my code that has been used:
from chatterbot import ChatBot
from chatterbot.trainers import ChatterBotCorpusTrainer
bot = ChatBot(
"Terminal",
storage_adapter="chatterbot.storage.SQLStorageAdapter",
trainer = "chatterbot.trainers.ChatterBotCorpusTrainer",
logic_adapters=[
{
"import_path": "chatterbot.logic.BestMatch",
"statement_comparison_function": "chatterbot.comparisons.levenshtein_distance",
"response_selection_method": "chatterbot.response_selection.get_most_frequent_response"
}
]
)
def get_feedback():
text = input()
if 'yes' in text.lower():
return False
elif 'no' in text.lower():
return True
else:
print('Please type either "Yes" or "No"')
return get_feedback()
print("Type something to begin...")
while True:
try:
request=input()
input_statement = bot.input.process_input(request)
temp1,response = bot.generate_response(
input_statement,1
)
bot.output.process_response(response)
print('\n Is "{}" a coherent response to "{}"? \n'.format(response, input_statement))
if get_feedback():
print("please input the correct one")
request1=input()
response1 = bot.input.process_input(request1)
bot.learn_response(response1, input_statement)
print("Responses added to bot!")
except (KeyboardInterrupt, EOFError, SystemExit):
break
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (2 by maintainers)
Top GitHub Comments
It a problem of incompatibility of the given code and the installed ChatterBot version. try to install the latest ChatterBot and try again. meanwhile i will try to see whats wrong
Hi @Aljumaili85
Thanks for the prompt response.
Upgraded the chatterbot version. I have the following errors now: