【问题标题】:How to capture the LUIS JSON response to a user's input using LUIS recognizer in node js如何在节点 js 中使用 LUIS 识别器捕获对用户输入的 LUIS JSON 响应
【发布时间】:2018-06-19 12:58:59
【问题描述】:
// Assigning the published LUIS app URL which is obtained after training the related utterances in LUIS.
LuisModelUrl = 'https://' + luisAPIHostName + '/luis/v2.0/apps/' + luisAppId + '?subscription-key=' + luisAPIKey+'/&verbose=true&q= /';
console.log(LuisModelUrl);
//recognizing the intents using LUIS Recognizer
var recognizerData = new builder.LuisRecognizer(LuisModelUrl);
console.log("------------"+JSON.stringify(recognizerData.intents));
有人可以指导如何使用节点 js 做到这一点。
【问题讨论】:
标签:
node.js
azure-language-understanding
【解决方案1】:
如果您只想对 LUIS 执行一次性调用,而不是将 LuisRecognizer 插入机器人,LuisRecognizer 有一个静态 recognize 方法,您可以使用它来调用您的 LUIS 模型。
LuisModelUrl = 'https://' + luisAPIHostName + '/luis/v2.0/apps/' + luisAppId +
'?subscription-key=' + luisAPIKey+'/&verbose=true&q= /'
// Callback that console logs the intents
function printData (err, intents, entities) {
if (err) {
throw err
}
console.log("------------"+ JSON.stringify(intents))
}
//recognizing the intents using LUIS Recognizer
builder.LuisRecognizer.recognize('I love chairs', LuisModelUrl, printData)