BotFramework:获取IntentDialog的概率分数

是否有可能得到IntentDialogs的概率分数(0-1)? 所以我想知道机器人是如何有信心回答这个问题的,在此基础上我想要执行某些操作。 我怎样才能做到这一点? 我正在使用QnAMaker和一些硬编码的对话框。

示例代码:

 var qnarecognizer = new cognitiveservices.QnAMakerRecognizer({ knowledgeBaseId: '', subscriptionKey: '', top:4}); var intentrecognizer = new builder.IntentDialog(); var intents = new builder.IntentDialog({ recognizers: [intentrecognizer, qnarecognizer] }); bot.dialog('/', intents); intents.matches('qna', [ function (session, args, next) { var answerEntity = builder.EntityRecognizer.findEntity(args.entities, 'answer'); session.send(answerEntity.entity); } ]); intents.matchesAny([/Test/i], [ function (session) { session.send('This is not from QnA Maker.'); } ]); intents.onDefault( [ function (session) { session.send('Sorry, I don\'t know that.'); } ]); 

得分是实体本身的财产。 以下将通过发送一条消息给用户,为每个qna答案提供相应的分数:

 intents.matches('qna', [ function (session, args, next) { args.entities.forEach(function(element) { session.send('score=' + element.score + ':' + element.entity); }, this); } ]); 

你可以在这里findfindBestMatch 。 正如你所看到的,你可以使用以下方式获得匹配:

 var matches = EntityRecognizer.findAllMatches(choices, utterance, threshold); 

获得一场比赛的得分喜欢如下:

 matches[i].score