node.js - 引导 Alexa 做出特定槽值响应

标签 node.js alexa-skills-kit alexa-skill alexa-slot

我在 Amazon 开发者控制台中定义了自定义插槽类型,该插槽包含名称列表,如下所示。

homer simpson
ned flanders
principal skinner
comic book guy

然后我将示例话语定义如下。

PlayAudio to play {Name}

所以最后,我希望用户能够说出类似于以下内容的内容:

Alexa, ask the simpsons to play homer simpson

Alexa, ask the simpsons to play ned flanders

Alexa, ask the simpsons to play principal skinner

Alexa, ask the simpsons to play comic book guy

当然,Alexa 听错名字的可能性极高,因此我需要能够将听到的名字与插槽值之一尽可能匹配。

我将如何做到这一点,我是否必须在函数中对其进行编码,或者是否有更好的方法?

最佳答案

使用自定义槽时,Alexa 有可能提供列表中没有的值。随着列表规模的增大,这会变得特别成问题。按照 Tom 建议使用 Beta 测试功能可能会有所帮助,但您将无法发现所有问题,并且最终无法扩展。

我发现,完全确保您从列表中获得值(value)的唯一方法是在技能中拥有完整的列表并每次都进行检查。为了进行检查,精确匹配并不总是最好的选择,我尝试了两种方法:

关于node.js - 引导 Alexa 做出特定槽值响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44604620/

相关文章:

node.js - 将 Alexa SDK 模块安装到本地 Node 环境有什么意义?

node.js - SSL:服务器证书链不完整

node.js - 你如何使用 typescript 编写 Node 模块?

javascript - Babel 插件 "transform-runtime"仅在首次编译后有效

node.js - HTTP Post 请求未在 AWS Lambda 中通过

amazon - 如何定义不是列表的自定义插槽类型?

node.js - 在对话 Node alexa-sdk 期间更改卡

node.js - 亚马逊 Alexa 阅读谷歌电子表格

asynchronous - 将语音 "Ajax Spinner"添加到长时间运行的 Alexa Response

node.js - 在 systemctl 服务文件中从 ExecStart 运行 npm start