hi gunther,
I wanted to know if there is a way to set a default response like (i don't understand what you mean)
if no matching input is found
-Dattatreya
i am trying to set a threshold value in the closest match adapter for levenshtein distance
is this correct ?
hi @datta90 You use the process method of your logic adapter to get the confidence of the response then set the threshold on the confidence.
input = 'does linux rock'
bot = ChatBot('tux')
statement = bot.input.process_input(input)
confidence, response = bot.logic.process(statement)
if confidence > THRESHOLD:
response = bot.output.process_response(response)
else
response = 'I don't understand what you mean'
Maybe @gunthercox has a better way of doing it :)
@alekaizer That is an excellent example. There isn't a better way to provide a default response, I usually recommend something similar to that as a solution.
i am getting this error when i type the above code in python terminal
In [9]: statement = bot.logic.input.process_input(input1)
----------------------------------------------------------------------
AttributeError Traceback (most recent call
<ipython-input-9-794f22aa52a2> in <module>()
----> 1 statement = bot.logic.input.process_input(input1)
AttributeError: 'MultiLogicAdapter' object has no attribute 'input'
@datta90 Are you sure you are typing it into the terminal _exactly_ as it was written above?
The error message is correct, there is no .input attribute after .logic. I think maybe you meant to type just bot.input.process_input.
thank you gunther
I am getting error UnicodeDecodeError: 'utf8' codec can't decode byte 0x93 in position 83: invalid start byte when i am adding my own training data in the English folder,
my file name is ending with .corpus.json and i have written this file properly
even when i am remove this file i am still getting this error
is it because of json adapter storage my strings are bit long in the file
A UnicodeDecodeError is a Python error that is triggered when a file is opened for reading without the encoding being properly specified. I'll look into this to make sure that ChatterBot's corpus reader is specifying it correctly.
@datta90 I've made a correction to the German corpus that should fix the issue you reported: https://github.com/gunthercox/ChatterBot/pull/394
No problem gunther actually mistake was from my side I used regex to remove the ASCII characters present in my JSON file
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
@alekaizer That is an excellent example. There isn't a better way to provide a default response, I usually recommend something similar to that as a solution.