alexa-skills-kit - Amazon Alexa - 一个意图启用话语

标签 alexa-skills-kit

在 Amazon Alexa 中,有没有办法让一个意图初始化一组话语?

我问这个问题是因为除了时间和地点之外我还需要识别汽车的型号。为汽车/地点添加插槽似乎很荒谬,因为可能有 8000 多种可能性。

例如:

valetService.prototype.launch = fucntion(intent, session, response){
  if(intent.slots['vehicleType'] === 'car'){
    response.ask('Which vehicle?', *activate utterance*);
  }
};

如果这是不可能的,我可以创建一系列函数来处理每条必要的信息,然后每次更改单个单词意图的目标函数吗?

最佳答案

您不需要做您的问题所针对的事情。您试图避免的(不是定义自定义插槽类型)实际上是您问题的答案。

您可以根据需要使用自定义插槽类型。我同意列出所有可能的选项是荒谬的,但这就是问题:你不必这样做!

您所要做的就是定义一个自定义插槽类型,也许添加一些值,因为我不确定您是否可以不这样做就完成了。 Alexa 会将插槽的值发送到您的技能,即使它不在列表中。用亚马逊的话来说:

Note that a custom slot type is not the equivalent of an enumeration. Values outside the list may still be returned if recognized by the spoken language understanding system. Although input to a custom slot type is weighted towards the values in the list, it is not constrained to just the items on the list. Your code still needs to include validation and error checking when using slot values. See the “Handling Possible Input Errors” section of Handling Requests Sent by Alexa.

您可以找到有关它的所有信息 here .

关于alexa-skills-kit - Amazon Alexa - 一个意图启用话语,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40142685/

相关文章:

alexa-skills-kit - 在 Alexa 自定义技能上设置提醒/计时器?

alexa-skills-kit - 在发布之前,我可以在开发过程中让其他人访问我的 Alexa Skill 吗?

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

python - 如何用Python查询和获取Alexa槽值问sdk

python - Alexa 技能立即超时

alexa-skills-kit - 如何创建接受货币金额的插槽

oauth - Alexa 帐户与 Google OAuth 链接错误

javascript - Lambda 错误未被 try/catch block 或错误处理程序捕获

amazon-web-services - 使用 Amazon Alexa 和 DynamoDB 进行日常持久化

javascript - Alexa ask-cli 如何添加自定义 https 服务器