当多个意图的分数高于默认阈值时,意图处理程序不起作用

时间:2017-07-04 09:18:44

标签: node.js botframework luis

当多个LUIS意图的各自得分高于默认阈值(0.1)时,不会处理高得分意图。例如,这是我收到的LUIS响应:

"entities": [],
  "intents": [
    {
      "intent": "Good",
      "score": 0.38138606327968266
    },
    {
      "intent": "Not Good",
      "score": 0.14239219383059437
    },
    {
      "intent": "getInfo1",
      "score": 0.058470389996233038
    },
    {
      "intent": "getInfo3",
      "score": 0.052354321946208544
    },
    {
      "intent": "End Conversation",
      "score": 0.051956717501244802
    },
    {
      "intent": "getInfo2",
      "score": 0.049671852402879912
    },
    {
      "intent": "getInfo4",
      "score": 0.04166953247839323
    },
    {
      "intent": "getInfo5",
      "score": 0.032684937293639832
    },
    {
      "intent": "getInfo6",
      "score": 0.027630602530947044
    },
    {
      "intent": "getInfo7",
      "score": 0.027075797198458249
    }
  ],
  "query": "iam good",
  "topScoringIntent": {
    "intent": "Good",
    "score": 0.38138606327968266
  }
}

我认为以下意图正在陷入某种冲突,因为他们都有分数> 0.1。 我尝试为各个处理程序的intentThreshold添加triggerAction参数。但是,没有用。

  

{“intent”:“Good”,“score”:0.38138606327968266},{“intent”:“Not not   好“,”得分“:0.14239219383059437}

代码示例

//BOT REST end point
var server = restify.createServer(options);
server.listen(config.port,function() {
    console.log('%s listening to %s', server.name, server.url);
});

var connector = new builder.ChatConnector({
    appId: config.BOTFRAMEWORK_APPID, 
    appPassword: config.BOTFRAMEWORK_APPSECRET
});
server.post('/test', connector.listen());

var bot = new builder.UniversalBot(connector);
var recognizer = new builder.LuisRecognizer(config.model);

bot.recognizer(recognizer);

bot.dialog("/",[function(session){
  if(utilities.isEmpty(session.userData.name)) {
    // Greetings
    builder.Prompts.text(session,prompt.greeting_text);
    }else {
          session.beginDialog("/beginConversation");
    }
  },
  function(session,results){
    session.userData.name = results.response;
    console.log("username :"+ session.userData.name);
    session.beginDialog("/beginConversation");
}]);
// beginConversation
bot.dialog("/beginConversation", function(session){
  builder.Prompts.text(session,"Hello "+session.userData.name+"! "+prompt.conversation_begin_text);
});

// userGood
bot.dialog("/userGood", function(session){
  session.userData.isHappy = true;
  builder.Prompts.text(session,prompt.user_good_response_text+" "+prompt.address_query_text);
}).triggerAction({
  matches: "Good",
  intentThreshold:0.20
});
// userBad
bot.dialog("/userBad", function(session){
  session.userData.isHappy = false;
  builder.Prompts.text(session,prompt.user_bad_response_text+" "+prompt.address_query_text);
}).triggerAction({
  matches: "Not Good",
  intentThreshold:0.20
});

会话流程:

  

用户:您好Bot:来自机器人的问候!请告诉我你的名字

     

用户:John Doe

     

Bot:你好John Doe!你好吗?

     

用户:我很好

我认为应始终触发与最高得分意图相对应的意图处理程序。机器人应该根据这个意图处理程序做出响应。

但是,尽管明确将intentThreshold triggerAction参数设置为不同的阈值,但多个意图超过默认意图阈值时没有响应。

我在这里做错了吗?

SDK版本:3.8.4

0 个答案:

没有答案