Родитель
c0299d50c9
Коммит
3e56c307f4
|
@ -26,6 +26,7 @@ Use the `Deploy to Azure` button to quickly create an Azure LUIS service. You ge
|
|||
|[App model definition - Colors](./documentation-samples/Examples-Colors/) |||||||| ✔ |
|
||||
|[App model definition - IoT](./documentation-samples/examples-IoT) |||||||| ✔ |
|
||||
|[Phrase lists](./examples/phrase_list) | | ||||||✔|
|
||||
|[Bing Spell Check](./examples/bing-spell-check) | | ||✔|||||
|
||||
|
||||
\* = example demonstrates complete cycle: create, train, publish, query
|
||||
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
# IoT application
|
||||
|
||||
This LUIS app provides a starting point for an IoT app for a Home automation system.
|
||||
|
||||
## Intents
|
||||
|
||||
It has the following intents:
|
||||
|
||||
* HomeAutomation.TurnOff
|
||||
* HomeAutomation.TurnOn
|
||||
* None
|
||||
|
||||
## Entities
|
||||
|
||||
It has the following entities:
|
||||
|
||||
* HomeAutomation.Device
|
||||
* HomeAutomation.Operation
|
||||
* HomeAutomation.Room
|
||||
|
||||
## Labeled utterances
|
||||
This application has many labeled utterances.
|
||||
|
||||
## Import
|
||||
To import the LUIS app, log in to www.luis.ai, go to **My apps**, and click **Import App**. Choose the file `IoT Quickstart with Prebuilt Domain.json` and click **Import**.
|
|
@ -0,0 +1,87 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>LUIS Endpoint with Bing Spell Check</title>
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h2>IOT App - query with Bing Spell Check</h2>
|
||||
<p>This example queries the public LUIS IoT app. You must have a Bing Spell Check subscription ID!<hr>
|
||||
<form id="LUISform" method="" action="">
|
||||
<!-- This is your programmatic key, available in luis.ai under Account Settings -->
|
||||
LUIS Subscription or Programmatic ID, available in <a href="https://www.luis.ai">https://www.luis.ai</a> under Account Settings<br>
|
||||
<input type="text" size="50" id="programmaticID" value="" />
|
||||
<br><br>
|
||||
|
||||
<!-- This is the Bing Spell Check subscription id-->
|
||||
Bing Spell Check Subscription ID<br>
|
||||
<input type="text" size="50" id="bingspellcheck" value="" />
|
||||
<br><br>
|
||||
<input type="checkbox" id="spell" checked="checked"> Enable Bing Spell Check?
|
||||
<br><br>
|
||||
|
||||
<!-- Text area for query -->
|
||||
<textarea cols="70" rows="5" id="query" >turn the lighzs on</textarea>
|
||||
<br><br>
|
||||
|
||||
<input id="submit" type="button" value="submit" /><br>
|
||||
<br><br><br>
|
||||
<!-- HTTP Response message -->
|
||||
<label id="url"></label><br>
|
||||
<textarea cols="50" rows="20" id="response"></textarea>
|
||||
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
|
||||
$('#submit').click(function () {
|
||||
|
||||
var LUIS_PROGRAMMATIC_ID = $("#programmaticID").val();
|
||||
var BING_SPELL_CHECK_ID = $("#bingspellcheck").val();
|
||||
var enable_BING_SPELL_CHECK_ID = $("#spell").prop('checked');
|
||||
var query = $("#query").val();
|
||||
|
||||
var params = {
|
||||
// These are optional request parameters. They are set to their default values.
|
||||
"q": query,
|
||||
"timezoneOffset": "0",
|
||||
"verbose": "false",
|
||||
"staging": "false",
|
||||
"bing-spell-check-subscription-key": BING_SPELL_CHECK_ID,
|
||||
"spellCheck" : true
|
||||
};
|
||||
|
||||
if (!enable_BING_SPELL_CHECK_ID) {
|
||||
params.spellCheck = false;
|
||||
}
|
||||
|
||||
var url = "https://westus.api.cognitive.microsoft.com/luis/v2.0/apps/df67dcdb-c37d-46af-88e1-8b97951ca1c2?" + $.param(params);
|
||||
$('#url').text(url);
|
||||
|
||||
$.ajax({
|
||||
// public IoT app
|
||||
url: url,
|
||||
beforeSend: function (xhrObj) {
|
||||
// Request headers
|
||||
xhrObj.setRequestHeader("Ocp-Apim-Subscription-Key", LUIS_PROGRAMMATIC_ID);
|
||||
},
|
||||
type: "GET",
|
||||
// The request body may be empty for a GET request
|
||||
//data: "{body}",
|
||||
})
|
||||
.done(function (data) {
|
||||
var pretty = JSON.stringify(JSON.parse(JSON.stringify(data)),null,2);
|
||||
$("#response").text(pretty);
|
||||
})
|
||||
.fail(function (data) {
|
||||
var pretty = JSON.stringify(JSON.parse(JSON.stringify(data)),null,2);
|
||||
$("#response").text(pretty);
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -0,0 +1,13 @@
|
|||
# LUIS Query with spell check
|
||||
|
||||
This Javascript example sends a query to the LUIS endpoint with Bing Spell Check turned on. This example corrects any misspelling with your own Bing Spell Check ID before it is submitted to the public IoT LUIS app.
|
||||
|
||||
![Results from LUIS with corrected query](screenshot.png)
|
||||
|
||||
## Prerequisites
|
||||
* [Bing Spell Check](https://azure.microsoft.com/en-us/services/cognitive-services/spell-check/) subscription.
|
||||
* [LUIS](https://azure.microsoft.com/en-us/services/cognitive-services/language-understanding-intelligent-service/) subscription.
|
||||
|
||||
## Misspelled query
|
||||
The query `turn the lighzs on` is misspelled on purpose. When the query is run, the response will include the `alteredQuery` field -- the text of the query submitted to LUIS.
|
||||
|
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 40 KiB |
Загрузка…
Ссылка в новой задаче