LUIS意图不被机器人识别

问题描述 投票:1回答:2

编辑

所有人都很抱歉,这只是因为意图名称后面缺少逗号。我很抱歉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应用程序,以防万一,但无济于事。

知道为什么吗?

node.js luis
2个回答
1
投票

对不起,伙计们,我所遗漏的只是代码中的一个逗号,紧挨着意图名称('bot-existence')。编辑的代码段如下!

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

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

0
投票

尝试这种方式,使用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'});
© www.soinside.com 2019 - 2024. All rights reserved.