alexa - 在 Alexa 中获取相对时间

标签 alexa alexa-skills-kit alexa-skill alexa-slot

我正在尝试开发 Alexa 技能,我需要获取相对时间,例如:“ 5 分钟前 ”。

我为我的技能定义了一个时间段,它接受像 5 minutes 这样的时间, 6.30 am4 in the morning .但我无法接受像 5 minutes ago 这样的时间.我是 Alexa 的新手,有人可以帮我解决这个问题吗

{
  "slots": [
    {
      "name": "time",
      "type": "AMAZON.TIME"
    }
  ],
  "intent": "ReportTime"
}

最佳答案

您可以添加 {modifier}可以使用多个关键字的插槽,例如“以前”和“从现在开始”。然后, intent 可能具有类似于以下话语的内容:

{
  "name": "TimeTest",
  "samples": [
    "what happened {time} {modifier}",
    "what will happen {time} {modifier}"
  ],
  "slots": [
    {
      "name": "time",
      "type": "AMAZON.TIME",
      "samples": []
    },
    {
      "name": "modifier",
      "type": "custom_time_modifier",
      "samples": []
    }
  ]
}

具有以下自定义修饰符类型:
"types": [
{
  "name": "custom_time_modifier",
  "values": [
    {
      "id": null,
      "name": {
        "value": "ago",
        "synonyms": [
          "in the past"
        ]
      }
    },
    {
      "id": null,
      "name": {
        "value": "from now",
        "synonyms": [
          "in the future"
        ]
      }
    }
  ]
}

关于alexa - 在 Alexa 中获取相对时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45157047/

相关文章:

amazon-web-services - Alexa 智能家居技能 : Issue with device discovery

curl - Alexa SMAPI 错误,请求的参数无效 : scope

python - 使用 Alexa 流式传输音频的最简单示例

javascript - Array.find 不是函数错误

amazon-web-services - 在 Amazon Web Services 控制台上上传 lambda 函数代码时出现问题

alexa-skills-kit - Alexa 技能套件 (ASK) 和话语

javascript - Alexa 问答技能

javascript - Alexa Node js Lambda 函数给出响应 null

alexa - 我们可以在 Alexa 中引出不同 intent 的插槽吗

python - Alexa 技能 : how to detect display in Python?