如何使用用户文本查询预测运行时How to query the prediction runtime with user text
若要了解 LUIS 预测终结点返回的内容,请在 Web 浏览器中查看预测结果。To understand what a LUIS prediction endpoint returns, view a prediction result in a web browser.
先决条件Prerequisites
若要查询公共应用,需要:In order to query a public app, you need:
- 语言理解 (LUIS) 资源信息:Your Language Understanding (LUIS) resource information:
- 预测密钥 - 可从 LUIS 门户获取。Prediction key - which can be obtained from LUIS Portal. 如果还没有用于创建密钥的订阅,可以注册一个试用版。If you do not already have a subscription to create a key, you can register for a Trial.
- 预测终结点子域 - 该子域也是 LUIS 资源的名称 。Prediction endpoint subdomain - the subdomain is also the name of your LUIS resource.
- LUIS 应用 ID - 使用
df67dcdb-c37d-46af-88e1-8b97951ca1c2
的公共 IoT 应用 ID。A LUIS app ID - use the public IoT app ID ofdf67dcdb-c37d-46af-88e1-8b97951ca1c2
. 快速入门代码中使用的用户查询特定于该应用。The user query used in the quickstart code is specific to that app.
使用浏览器查看预测Use the browser to see predictions
打开 Web 浏览器。Open a web browser.
使用以下完整 URL(请将
YOUR-KEY
替换为你自己的 LUIS 预测密钥)。Use the complete URLs below, replacingYOUR-KEY
with your own LUIS Prediction key. 请求为 GET 请求,并包含授权(使用 LUIS 预测密钥作为查询字符串参数)。The requests are GET requests and include the authorization, with your LUIS Prediction key, as a query string parameter.GET 终结点(按槽)请求的 V3 URL 格式为:The format of the V3 URL for a GET endpoint (by slots) request is:
https://YOUR-LUIS-ENDPOINT-SUBDOMAIN.api.cognitive.azure.cn/luis/prediction/v3.0/apps/df67dcdb-c37d-46af-88e1-8b97951ca1c2/slots/production/predict?query=turn on all lights&subscription-key=YOUR-LUIS-PREDICTION-KEY
将该 URL 粘贴到浏览器窗口中,然后按 Enter。Paste the URL into a browser window and press Enter. 浏览器显示的 JSON 结果指示 LUIS 将
HomeAutomation.TurnOn
意向检测为首要意向,并检测到值为on
的HomeAutomation.Operation
实体。The browser displays a JSON result that indicates that LUIS detects theHomeAutomation.TurnOn
intent as the top intent and theHomeAutomation.Operation
entity with the valueon
.{ "query": "turn on all lights", "prediction": { "topIntent": "HomeAutomation.TurnOn", "intents": { "HomeAutomation.TurnOn": { "score": 0.5375382 } }, "entities": { "HomeAutomation.Operation": [ "on" ] } } }
要查看所有意图,请添加相应的查询字符串参数。To see all the intents, add the appropriate query string parameter.
将
show-all-intents=true
添加到查询字符串末尾可 显示所有意向:Addshow-all-intents=true
to the end of the querystring to show all intents:https://YOUR-LUIS-ENDPOINT-SUBDOMAIN.api.cognitive.azure.cn/luis/predict/v3.0/apps/df67dcdb-c37d-46af-88e1-8b97951ca1c2/slots/production/predict?query=turn on all lights&subscription-key=YOUR-LUIS-PREDICTION-KEY&show-all-intents=true
{ "query": "turn off the living room light", "prediction": { "topIntent": "HomeAutomation.TurnOn", "intents": { "HomeAutomation.TurnOn": { "score": 0.5375382 }, "None": { "score": 0.08687421 }, "HomeAutomation.TurnOff": { "score": 0.0207554 } }, "entities": { "HomeAutomation.Operation": [ "on" ] } } }
后续步骤Next steps
了解有关以下方面的详细信息:Learn more about: