【问题标题】:LUIS Intent not recognized by bot机器人无法识别 LUIS 意图
【发布时间】:2018-02-15 02:49:13
【问题描述】:

编辑

对不起大家,这只是由于意图名称后面缺少逗号。我很抱歉x:


我最近正在使用 Microsoft Bot Framework (botbuilder v3.14.0)、Node.js (v8.9.4) 和 LUIS 创建一个聊天机器人。

我能够成功地“识别”机器人中的一些意图,并返回所需的结果,但对于某些意图,机器人似乎无法识别这些意图,即使 LUIS 的结果是指向正确的。

我尝试使用 LUIS 测试刀片进行测试,并在 chrome 中的端点 URL 之后直接输入查询。这两种方法都会返回相同且正确的意图。端点 URL 方法的示例结果如下:

{
  "query": "why do you exist",
  "topScoringIntent": {
    "intent": "bot-existence",
    "score": 0.597947
  },
  "intents": [
    {
      "intent": "bot-existence",
      "score": 0.597947
    },
    {
      "intent": "bot-joke",
      "score": 0.04189388
    },
    {
      "intent": "Exit",
      "score": 0.0182088781
    },
    {
      "intent": "None",
      "score": 0.0164906159
    },
    {
      "intent": "Cancel",
      "score": 0.009767669
    },
    {
      "intent": "Stop",
      "score": 0.009608646
    },
    {
      "intent": "bot-age",
      "score": 0.009238302
    },
    {
      "intent": "Greeting",
      "score": 0.008374314
    },
    {
      "intent": "bot-name",
      "score": 0.00683666952
    },
    {
      "intent": "Help",
      "score": 0.00357789616
    },
    {
      "intent": "StartOver",
      "score": 0.00262053218
    },
    {
      "intent": "checkDBStatus",
      "score": 0.002412489
    },
    {
      "intent": "refreshSchema",
      "score": 1.35339326E-06
    },
    {
      "intent": "checkDutyPerson",
      "score": 5.41015623E-08
    }
  ],
  "entities": []
}

在这种情况下,机器人应该能够挑选出bot-existence 意图并执行以下代码:

intents.matches('bot-existence' [
    function (session) {
        console.log('bot-existence Intent');

        session.beginDialog('bot-existDialog');
    }
]);

但事实并非如此。但它适用于其他意图,例如bot-agebot-jokecheckDBStatus。这些意图的代码与上面bot-existence 的代码相同,只是进行了编辑以适当地适应意图。为了以防万一,我还多次发布了 LUIS 应用,但无济于事。

知道为什么吗?

【问题讨论】:

  • 成功触发bot-agebot-joke等的话语得分是多少?您是否尝试过降低 IntentDialog 的意图分数阈值?
  • 我无法重现您的问题,您是否在添加 bot-existence 意图后发布了您的 luis?
  • @StevenG.,感谢您的回复。 bot-age 带有“你的年龄”是0.8824824bot-joke 带有“告诉我一个笑话”是0.277950644。如何降低意图分数阈值?
  • @GraceFeng-MSFT,感谢您的回复。事实上,我确实发布了 luis 应用,检查并再次发布了几次。
  • @StevenG。感谢您回来查看!我很高兴我发现了这个错误,我太粗心了!

标签: node.js azure-language-understanding


【解决方案1】:

对不起,伙计们,我所缺少的只是代码中的一个逗号,就在意图名称('bot-existence')旁边。编辑代码段如下!

intents.matches('bot-existence', [
    function (session) {
        console.log('bot-existence Intent');

        session.beginDialog('bot-existDialog');
    }
]);

【讨论】:

    【解决方案2】:

    试试这个方法,使用triggerAction:

    var recognizer = new builder.LuisRecognizer(LuisModelUrl);
    // Add the recognizer to the bot
    bot.recognizer(recognizer);
    
    bot.dialog('bot-existence', [
    
      function (session, args) {
            console.log('bot-existence Intent');
            session.beginDialog('bot-existDialog');
        }      
    ]).triggerAction({matches:'bot-existence'});
    

    【讨论】:

    • 虽然这是在机器人内部使用 LUIS 的有效方法(事实上,我还建议用户将他们的识别器插入机器人而不是使用 IntentDialog),但它并没有解决这个问题用户的其他意图代码确实有效。
    • @SarthakSerivastava,感谢您的回复。我希望我不必这样做,因为我宁愿只使用 luis 的意图来识别和处理我能想到的尽可能多的用户输入。
    • @belcsy,他们的方法对于使用 LUIS 是有效的 :) 这只是与使用 IntentDialog 类不同的方法,我们有一个使用这种方法的示例,可以找到 here跨度>
    • @SarthakSrivastava,@Steven G. - 哦,我的错,我不知道。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-01-05
    • 1970-01-01
    相关资源
    最近更新 更多