簡體   English   中英

機器人無法識別 LUIS 意圖

[英]LUIS Intent not recognized by bot

編輯

很抱歉大家,這只是由於意圖名稱后缺少逗號。 我很抱歉 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-existence”)旁邊。 編輯代碼段如下!

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

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

試試這種方式,使用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'});

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM