Make chatbot (wit.ai) reply that it doesn't have a proper answer

人盡茶涼 提交于 2019-12-22 08:19:33

问题


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?


回答1:


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




回答2:


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.




回答3:


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!