如何将每个用户输入传递给 Bing 拼写检查,然后将其发送给 LUIS 进行处理。(Nodejs SDK v3)?
How to pass every user input to the Bing spell check and then send it to LUIS for processing.( Nodejs SDK v3)?
我找到了这个示例代码
var https = require ('https');
var msg = new builder.Message(session);
var host = 'api.cognitive.microsoft.com';
var path = '/bing/v7.0/spellcheck';
/* NOTE: Replace this example key with a valid subscription key (see the Prequisites section above). Also note v5 and v7 require separate subscription keys. */
var key = '****************';
var mkt = "en-US";
var mode = "proof";
var text = "nthgn can b done";
var query_string = "?mkt=" + mkt + "&mode=" + mode;
var request_params = {
method : 'POST',
hostname : host,
path : path + query_string,
headers : {
'Content-Type' : 'application/x-www-form-urlencoded',
'Content-Length' : text.length + 5,
'Ocp-Apim-Subscription-Key' : key,
// 'X-Search-Location' : CLIENT_LOCATION,
// 'X-MSEdge-ClientID' : CLIENT_ID,
// 'X-MSEdge-ClientIP' : CLIENT_ID,
}
};
var response_handler = function (response) {
var body = '';
response.on ('data', function (d) {
body += d;
});
response.on ('end', function () {
console.log (body);
});
response.on ('error', function (e) {
console.log ('Error: ' + e.message);
});
};
var req = https.request (request_params, response_handler);
req.write ("text=" + text);
req.end ();
1.How 我是否将每个用户输入发送到文本?
2.Is 处理后 window 可以在聊天中显示正确的拼写吗?
3.How 我要把这个发给 LUIS 吗?
任何有关文档或链接的帮助将不胜感激。
LUIS 具有 Bing 内置拼写检查功能。
您可以在 LUIS 仪表板中启用它,方法是:
> 管理 > 密钥和端点
然后,启用"Bing Spell Check"
任何时候您使用 builder.EntityRecognizer
或 builder.IntentRecognizer
,输入将首先转到 Bing 进行拼写检查,然后发送到 LUIS 进行意图和实体识别(回答问题 3 ).
这是我在将 "seattle" 拼写为 "seatle"(缺少 "t")时从 LUIS 获得的响应示例。
{
"query": "seatle",
"alteredQuery": "seattle",
"topScoringIntent": {
"intent": "Help",
"score": 0.340962738
},
"intents": [
{
"intent": "Help",
"score": 0.340962738
},
{
"intent": "SearchHotels",
"score": 0.274775743
},
{
"intent": "None",
"score": 0.03235885
},
{
"intent": "ShowHotelsReviews",
"score": 0.00128200091
}
],
"entities": [
{
"entity": "seattle",
"type": "builtin.geographyV2.city",
"startIndex": 0,
"endIndex": 6
}
]
}
您可以看到它已将 alteredQuery
中的拼写更正为 "seattle",并返回 "seattle" 作为 entity
底部的正确实体(回答问题 3) .
我在 one of the V3 sample bots 上测试过这个。但请注意,链接的机器人不使用 LUIS 进行拼写检查,而是提供了另一种使用 Bing 拼写检查 API 的方法(回答您的问题 1)。要让此机器人使用 LUIS 的集成 Bing 拼写检查,请将 .env
中的 IS_SPELL_CORRECTION_ENABLED
标志设置为 false
,然后将 LUIS_MODEL_URL
设置为包含您的 bing 订阅密钥,像这样:
LUIS_MODEL_URL=https://westus.api.cognitive.microsoft.com/luis/v2.0/apps/{LUIS-APP-ID}?spellCheck=true&bing-spell-check-subscription-key={BING-SPELL-CHECK-KEY}&verbose=true&timezoneOffset=-360&subscription-key={LUIS-SUBSCRIPTION-KEY}&q=
其他文档:
我找到了这个示例代码
var https = require ('https');
var msg = new builder.Message(session);
var host = 'api.cognitive.microsoft.com';
var path = '/bing/v7.0/spellcheck';
/* NOTE: Replace this example key with a valid subscription key (see the Prequisites section above). Also note v5 and v7 require separate subscription keys. */
var key = '****************';
var mkt = "en-US";
var mode = "proof";
var text = "nthgn can b done";
var query_string = "?mkt=" + mkt + "&mode=" + mode;
var request_params = {
method : 'POST',
hostname : host,
path : path + query_string,
headers : {
'Content-Type' : 'application/x-www-form-urlencoded',
'Content-Length' : text.length + 5,
'Ocp-Apim-Subscription-Key' : key,
// 'X-Search-Location' : CLIENT_LOCATION,
// 'X-MSEdge-ClientID' : CLIENT_ID,
// 'X-MSEdge-ClientIP' : CLIENT_ID,
}
};
var response_handler = function (response) {
var body = '';
response.on ('data', function (d) {
body += d;
});
response.on ('end', function () {
console.log (body);
});
response.on ('error', function (e) {
console.log ('Error: ' + e.message);
});
};
var req = https.request (request_params, response_handler);
req.write ("text=" + text);
req.end ();
1.How 我是否将每个用户输入发送到文本?
2.Is 处理后 window 可以在聊天中显示正确的拼写吗?
3.How 我要把这个发给 LUIS 吗?
任何有关文档或链接的帮助将不胜感激。
LUIS 具有 Bing 内置拼写检查功能。
您可以在 LUIS 仪表板中启用它,方法是:
> 管理 > 密钥和端点
然后,启用"Bing Spell Check"
任何时候您使用 builder.EntityRecognizer
或 builder.IntentRecognizer
,输入将首先转到 Bing 进行拼写检查,然后发送到 LUIS 进行意图和实体识别(回答问题 3 ).
这是我在将 "seattle" 拼写为 "seatle"(缺少 "t")时从 LUIS 获得的响应示例。
{
"query": "seatle",
"alteredQuery": "seattle",
"topScoringIntent": {
"intent": "Help",
"score": 0.340962738
},
"intents": [
{
"intent": "Help",
"score": 0.340962738
},
{
"intent": "SearchHotels",
"score": 0.274775743
},
{
"intent": "None",
"score": 0.03235885
},
{
"intent": "ShowHotelsReviews",
"score": 0.00128200091
}
],
"entities": [
{
"entity": "seattle",
"type": "builtin.geographyV2.city",
"startIndex": 0,
"endIndex": 6
}
]
}
您可以看到它已将 alteredQuery
中的拼写更正为 "seattle",并返回 "seattle" 作为 entity
底部的正确实体(回答问题 3) .
我在 one of the V3 sample bots 上测试过这个。但请注意,链接的机器人不使用 LUIS 进行拼写检查,而是提供了另一种使用 Bing 拼写检查 API 的方法(回答您的问题 1)。要让此机器人使用 LUIS 的集成 Bing 拼写检查,请将 .env
中的 IS_SPELL_CORRECTION_ENABLED
标志设置为 false
,然后将 LUIS_MODEL_URL
设置为包含您的 bing 订阅密钥,像这样:
LUIS_MODEL_URL=https://westus.api.cognitive.microsoft.com/luis/v2.0/apps/{LUIS-APP-ID}?spellCheck=true&bing-spell-check-subscription-key={BING-SPELL-CHECK-KEY}&verbose=true&timezoneOffset=-360&subscription-key={LUIS-SUBSCRIPTION-KEY}&q=
其他文档: