I am using Wit.ai
for my chatbot. The problem is that my bot always tries to answer something. I will only make my bot answer if it actually understood what was being asked. I know it is possible, but if I have a bot with very few replies, it seems it always chooses one of the replies even though it is asked something completely different.
I imagine it is possible to make it reply something like "I am sorry. I don't know what you are asking. I can help you with .....".
Maybe I should use the confidence value that I can retrieve, and make sure it's above some threshold?
Right now the best way to deal with this problem is to create one or more stories with out-of-scope requests, and add a "catchall" entity with strategy "trait" to the user message (more details here).
In the simplest case, your "catchall" entity will have a single value. You could have several values, for example if you want different kind of answers for different kind of out-of-scope requests, but keep in mind that the more complex your bot is, the more stories and data you will need to have to make it working correctly.
We are also working on a more elegant solution. Stay tuned here: https://github.com/wit-ai/wit
A simple solution is to create a story without intent, with the bot answering something like "I don't understand"
This story will be started when no other intent is relevant. It works pretty well according to our experience.
You can create some function to handle intent of the user-input message.
function handleIntent(intent, sender) {
switch(intent) {
case "jokes":
//Do Something
break;
case "greeting":
//Do Something
break;
case "identification":
//Do Something
break;
case "movie":
//Do Something
break;
default: // Any other intensions go here..
sendTextMessage(sender, "I couldn't understand that one :(")
break;
}
}
Hope the idea helps! :)
来源:https://stackoverflow.com/questions/38334663/make-chatbot-wit-ai-reply-that-it-doesnt-have-a-proper-answer