在 Alexa 中获取相对时间
Getting Relative Time in Alexa
我正在尝试开发一项 Alexa 技能,我需要获取相对时间,例如:“5 分钟前”。
我已经为我的技能定义了一个时间段,它接受像 5 minutes
、6.30 am
或 4 in the morning
这样的时间。但是我无法接受像 5 minutes ago
这样的时间。我是 Alexa 的新手,有人可以帮我解决这个问题吗
{
"slots": [
{
"name": "time",
"type": "AMAZON.TIME"
}
],
"intent": "ReportTime"
}
您可以添加一个 {modifier}
插槽,它可以包含多个关键字,例如 "ago" 和 "from now"。然后,意图可能有类似以下的语句:
{
"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 技能,我需要获取相对时间,例如:“5 分钟前”。
我已经为我的技能定义了一个时间段,它接受像 5 minutes
、6.30 am
或 4 in the morning
这样的时间。但是我无法接受像 5 minutes ago
这样的时间。我是 Alexa 的新手,有人可以帮我解决这个问题吗
{
"slots": [
{
"name": "time",
"type": "AMAZON.TIME"
}
],
"intent": "ReportTime"
}
您可以添加一个 {modifier}
插槽,它可以包含多个关键字,例如 "ago" 和 "from now"。然后,意图可能有类似以下的语句:
{
"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"
]
}
}
]
}