【发布时间】:2016-07-28 16:31:51
【问题描述】:
我正在编写一个 Alexa Skill,我只能在我的代码中获取单个单词参数。
这是意图架构:
{
"intents": [
{
"intent": "HeroQuizIntent",
"slots": [
{
"name": "SearchTerm",
"type": "SEARCH_TERMS"
}
]
},
{
"intent": "HeroAnswerIntent",
"slots": [
{
"name": "SearchTerm",
"type": "SEARCH_TERMS"
}
]
},
{
"intent": "AMAZON.HelpIntent"
}
]
}
我的示例话语是:
HeroQuizIntent quiz me
HeroAnswerIntent is it {SearchTerm}
对于 HeroAnswerIntent,我正在检查 SearchTerm 槽,我只在其中得到单个单词。
所以,“Peter Parker”给“Parker”,“Steve Rogers”给“Rogers”,“Tony Stark”给“Stark”。
如何在一个槽中接受多个单词?
【问题讨论】:
-
你得到的 json 结构有什么线索吗?没有什么明显的。可能值得发布结构。
-
好点。这是发送到 Lamda 的请求的相关部分。
-
"request": { "type": "IntentRequest", "requestId": "EdwRequestId.da0c74ea-15bd-45b9-a69e-76c523f08195", "timestamp": "2016-04-08T18:04:45Z", "intent": { "name": "HeroAnswerIntent", "slots": { "SearchTerm": { "name": "SearchTerm", "value": "Parker" } } } }, -
所以,SearchTerm 插槽仍然只是我告诉 Alexa 的最后一个工作。似乎问题出在 Alexa 语音解释中,唯一的解决方案可能是接受多个插槽。这将是可悲的,因为它会在 lamda 函数中产生一些地狱般的逻辑。
标签: alexa alexa-skills-kit alexa-skill