亚马逊 Alexa:测试我的技能,将文本转换为 Lambda 请求

Amazon Alexa: Testing my skill, convert a text to Lambda Request

我已经定义了我的意图模式和示例话语,并且工作正常。我还可以使用 Service Simulator 和 Amazon dot 对其进行测试。

我想编写一个代码来获取文本并基于它创建 IntentRequest(了解 intentSchema)。我可以看到 Service Simulator 正在做类似的事情:它接收文本,发出 IntentRequest 并将其显示在名为 Lambda Request 的左侧框中。

如何做同样的事情?接收文本并识别意图和槽并将其转换为 IntentRequest(显然,不是手动)。

示例: 输入:"How is the weather in Austin?" 输出:类似于此的 IntentRequest 对象:

{
  "session": {
    "sessionId": "....",
    "application": {
      "applicationId": "... "
    },
    "attributes": {},
    "user": {...},
    "new": true
  },
  "request": {
    "type": "IntentRequest",
    "requestId": "reqid",
    "locale": "en-US",
    "timestamp": "...",
    "intent": {
      "name": "WeatherIntent",
      "slots": {...},
    }
  },
  "version": "1.0"
}

您应该使用 Lex、API.AI 或 Watson 等专用对话服务

他们将获得文字和return意图