你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Prediction - Get Slot Prediction

获取应用程序槽的预测。

POST {Endpoint}/luis/prediction/v3.0/apps/{appId}/slots/{slotName}/predict
POST {Endpoint}/luis/prediction/v3.0/apps/{appId}/slots/{slotName}/predict?verbose={verbose}&show-all-intents={show-all-intents}&log={log}

URI 参数

名称 必需 类型 说明
appId
path True

string

uuid

应用程序 ID。

Endpoint
path True

string

支持的认知服务终结点 (协议和主机名,例如: https://westus.api.cognitive.microsoft.com) 。

slotName
path True

string

应用程序槽名称。

log
query

boolean

指示是否记录终结点查询。

show-all-intents
query

boolean

指示是返回响应中的所有意向还是仅返回顶级意向。

verbose
query

boolean

指示是否获取实体预测的额外元数据。

请求头

名称 必需 类型 说明
Ocp-Apim-Subscription-Key True

string

请求正文

名称 必需 类型 说明
query True

string

要预测的查询。

dynamicLists

DynamicList[]

为此请求动态创建的列表实体。

externalEntities

ExternalEntity[]

此请求的外部预测实体。

options

PredictionRequestOptions

为此请求定义的自定义选项。

响应

名称 类型 说明
200 OK

PredictionResponse

提供的查询的预测。

Other Status Codes

Error

意外错误。

安全性

Ocp-Apim-Subscription-Key

Type: apiKey
In: header

示例

Successful Get Slot Predictions From Endpoint Via Post request

Sample Request

POST {Endpoint}/luis/prediction/v3.0/apps/{Application Id}/slots/{Slot Name}/predict


{
  "query": "forward to frank 30 dollars through HSBC",
  "options": {
    "datetimeReference": "2015-02-13T13:15:00.000Z"
  },
  "externalEntities": [
    {
      "entityName": "Bank",
      "startIndex": 36,
      "entityLength": 4,
      "resolution": {
        "text": "International Bank"
      }
    }
  ],
  "dynamicLists": [
    {
      "listEntityName": "Employees",
      "requestLists": [
        {
          "name": "Management",
          "canonicalForm": "Frank",
          "synonyms": []
        }
      ]
    }
  ]
}

Sample Response

{
  "query": "forward to frank 30 dollars through HSBC",
  "prediction": {
    "topIntent": "give",
    "intents": {
      "give": {
        "score": 0.943442
      }
    },
    "entities": {
      "Employees": [
        [
          "frank"
        ]
      ],
      "number": [
        30
      ],
      "money": [
        {
          "units": "Dollar",
          "value": 30
        }
      ],
      "Bank": [
        {
          "text": "International Bank"
        }
      ]
    },
    "sentiment": {
      "label": "positive",
      "score": 0.9163064
    }
  }
}

定义

名称 说明
DynamicList

定义列表实体的扩展。

Error

表示发生的错误。

ErrorBody

表示所发生错误的定义。

ExternalEntity

定义扩展现有实体的用户预测实体。

Intent

表示意向预测。

Prediction

表示查询的预测。

PredictionRequest

表示预测请求参数。

PredictionRequestOptions

预测请求的自定义选项。

PredictionResponse

表示预测响应。

RequestList

定义要追加到现有列表实体的子列表。

Sentiment

情绪分析的结果。

DynamicList

定义列表实体的扩展。

名称 类型 说明
listEntityName

string

要扩展的列表实体的名称。

requestLists

RequestList[]

要追加到扩展列表实体上的列表。

Error

表示发生的错误。

名称 类型 说明
error

ErrorBody

表示所发生错误的定义。

ErrorBody

表示所发生错误的定义。

名称 类型 说明
code

string

错误代码。

message

string

错误消息。

ExternalEntity

定义扩展现有实体的用户预测实体。

名称 类型 说明
entityLength

integer

预测实体的长度。

entityName

string

要扩展的实体的名称。

resolution

用户提供了自定义分辨率,以作为实体的预测返回。

score

number

用户提供的分数作为实体的预测分数返回。

startIndex

integer

预测实体的起始字符索引。

Intent

表示意向预测。

名称 类型 说明
childApp

Prediction

已调度应用程序的预测。

score

number

触发的意向的分数。

Prediction

表示查询的预测。

名称 类型 说明
alteredQuery

string

拼写检查后的查询。 仅当启用了拼写检查并且发现拼写错误时设置。

entities

表示触发的实体的字典。

intents

<string,  Intent>

表示触发的意向的字典。

sentiment

Sentiment

情绪分析的结果。

topIntent

string

评分最高的意向的名称。

PredictionRequest

表示预测请求参数。

名称 类型 说明
dynamicLists

DynamicList[]

为此请求动态创建的列表实体。

externalEntities

ExternalEntity[]

此请求的外部预测实体。

options

PredictionRequestOptions

为此请求定义的自定义选项。

query

string

要预测的查询。

PredictionRequestOptions

预测请求的自定义选项。

名称 类型 说明
datetimeReference

string

用于预测日期时间实体的引用 DateTime。

preferExternalEntities

boolean

如果发生重叠,是否使外部实体解析替代预测。

PredictionResponse

表示预测响应。

名称 类型 说明
prediction

Prediction

所请求查询的预测。

query

string

预测中使用的查询。

RequestList

定义要追加到现有列表实体的子列表。

名称 类型 说明
canonicalForm

string

子列表的规范形式。

name

string

子列表的名称。

synonyms

string[]

规范形式的同义词。

Sentiment

情绪分析的结果。

名称 类型 说明
label

string

情绪分析结果的标签。

score

number

查询的情绪分数。