I have made a simple Chatbot which can answer static queries. It is working ok so far But the problem is when a query is asked which is not in training data, it is just picking any random statement. I want Chatbot to answer some default statement like "I am not trained for this","I don't know"..etc. my code is as below:
bot = ChatBot(
"ChatBot",
logic_adapters=[
{
'import_path': 'chatterbot.logic.BestMatch'
},
{
'import_path': 'chatterbot.logic.BestMatch',
'threshold': 0.65,
'default_response': 'default_value'
}
],
response_selection_method=get_most_frequent_response,
input_adapter="chatterbot.input.VariableInputTypeAdapter",
output_adapter="chatterbot.output.OutputAdapter",
storage_adapter="chatterbot.storage.SQLStorageAdapter",
database="db.sqlite3"
)
def get_bot_response():
userText = request.args.get('msg')
botReply = str(bot.get_response(userText))
if botReply is "default_value":
botReply = str(bot.get_response('default_response'))
in my training data,I have set answers for 'default_response' as 'I don't know','I need to think on it' etc..
But, this is not working as botReply is already being parsed before going to if statement.
Can someone help on how to get default_response rather giving Random answers ?