带有LUIS的Microsoft Bot Framework无法检测所有意图 [英] Microsoft Bot Framework with LUIS not detecting all intents

查看:83
本文介绍了带有LUIS的Microsoft Bot Framework无法检测所有意图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用MS Bot框架和节点js中的LUIS创建聊天机器人.我已经创建了两个名为"Book"的意图.和待处理"以及称为年假"的实体,在LUIS中.我已经将LUIS URL添加到我的聊天机器人代码中,当我在控制台中对其进行测试时,我看到某些话语会得到响应,而有些话则没有.

I'm creating a chatbot using the MS Bot Framework with LUIS in node js. I have created a couple of intents called "Book" and "Pending" and an entity called "Annual Leave" in LUIS. I have added the LUIS URL to my chatbot code and when I test it in my console, I see that certain utterances get a response while some don't.

例如,当我说我如何检查剩余的年假?"时,我收到一条回答:您可以在这里找到您的剩余A/L".但是当我说如何检查待休年假?"时,我没有得到答复.

For example when I say "How do I check my remaining annual leave?", I get a response saying "You can find your remaining A/L here". But when I say "How can I check my pending annual leave?", I get no reply.

我对Git Bash的回应是对工作的回应

ChatConnector:已收到消息.

ChatConnector: message received.

session.beginDialog(/)

session.beginDialog(/)

/-session.sendBatch()发送0条消息

/ - session.sendBatch() sending 0 messages

/-IntentDialog.matches(待审核)

/ - IntentDialog.matches(Pending)

/-Waterfall()第1步,共1步

/ - waterfall() step 1 of 1

/-session.beginDialog(BotBuilder:Prompts)

/ - session.beginDialog(BotBuilder:Prompts)

.提示文本-session.send()

.Prompts.text - session.send()

.Prompts.text-session.sendBatch()发送1条消息

.Prompts.text - session.sendBatch() sending 1 messages

我的Git Bash针对非正常发声的响应

ChatConnector:已收到消息.

ChatConnector: message received.

.提示文本-session.endDialogWithResult()

.Prompts.text - session.endDialogWithResult()

/-session.endDialogWithResult()

/ - session.endDialogWithResult()

session.sendBatch()发送0条消息

session.sendBatch() sending 0 messages

但是当我在LUIS上测试完全相同的发音时,它会检测到具有高置信度得分的意图和实体.

But when I test the exact same utterances on LUIS, it detects the intent and entity with a high confidence score.

这是发生很多话的情况.我不知道是什么原因引起的.

This is happening with a lot of utterances. I can't figure out what's causing this issue.

我的聊天机器人代码

var restify = require('restify');
var builder = require('botbuilder');

//=========================================================
// Bot Setup
//=========================================================

// Setup Restify Server
var server = restify.createServer();
server.listen(process.env.port || process.env.PORT || 3978, function () {
   console.log('%s listening to %s', server.name, server.url); 
});
  
// Create chat bot
var connector = new builder.ChatConnector({
    appId: 'MY_APP_ID',
    appPassword: 'MY_APP_PASSWORD'
});
var bot = new builder.UniversalBot(connector);
server.post('/api/messages', connector.listen());

server.get('/', restify.serveStatic({
 directory: __dirname,
 default: '/index.html'
}));


//=========================================================
// Bots Dialogs
//=========================================================
    
var recognizer = new builder.LuisRecognizer('MY_LUIS_URL');
var intents = new builder.IntentDialog({ recognizers: [recognizer] });
bot.dialog('/', intents);
   

intents.matches('Book', [
    function (session, args, next) {
       var task = builder.EntityRecognizer.findEntity(args.entities, 'Annual Leave');
                  builder.Prompts.text(session, "You can book your A/L here.");  
    }
]),

intents.matches('Pending', [
    function (session, args, next) {
        var task = builder.EntityRecognizer.findEntity(args.entities, 'Annual Leave');
                  builder.Prompts.text(session, "You can find your remaining A/L here.");
       
    }
]);

推荐答案

首先,我建议您添加intents.onDefault()对话框,以便对None意图进行后备.这样,您将知道LUIS是否无法识别意图,还是其他原因.

First, I suggest that you add the intents.onDefault() dialog so you had a fallback for None intent. This way you will know if it's LUIS not recognizing the intent, or if it's something else.

第二,如果您使用IntentDialog,我将明确结束对话框.当您执行builder.Prompts.text()时,bot框架将在堆栈上推送一个特殊的Prompts对话框,并等待答案将其传递到不存在的瀑布中的next.我想知道这是否就是您正在经历的事情.尝试用session.endDialog(message)替换Prompts.text(message).

Second, I would explicitly end dialogs if you are using the IntentDialog. When you do builder.Prompts.text(), the bot framework will push a special Prompts dialog on stack and would wait for the answer to pass it to the next in your waterfall that is not there. I am wondering if that's what you're experiencing. Try replacing your Prompts.text(message) with session.endDialog(message).

最后,请考虑使用新的triggerAction语法.我在这里做了一些解释: http://www.pveller.com/smarter-conversations-part-2-open-dialogs/#Trigger-Actions

Last, consider using the new triggerAction syntax. I explained some of it here: http://www.pveller.com/smarter-conversations-part-2-open-dialogs/#Trigger-Actions

p.s.您还可以调试您的机器人.我是VS Code的忠实拥护者,就像在node_modulesbotbuilder源中设置断点一样简单,以查看正在发生的事情,如何识别和路由用户话语.

p.s. you can also debug your bot. I am big fan of VS Code and it's as easy as setting breakpoints in the botbuilder sources in your node_modules to see what's going on, how the user utterances are recognized, and routed.

这篇关于带有LUIS的Microsoft Bot Framework无法检测所有意图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆