如何为Alexa技能动态添加广告位值 [英] How to add slot values dynamically to alexa skill

查看:107
本文介绍了如何为Alexa技能动态添加广告位值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Alexa开发的新手。我已经使用AWS lambda函数和Node.js代码成功创建了Alexa技能。这是我的意图架构。

I am new in Alexa development. I have successfully create an Alexa skill with AWS lambda function and Node.js code. This is my intent schema.

{
  "intents": [
    {
      "slots": [
        {
          "name": "locationName",
          "type": "LOCATION_LIST"
        }
      ],
      "intent": "locationIntent"
    }
  ]
}

我已使用具有以下值的自定义广告位类型 LOCATION_LIST。

Also I have used custom slot type "LOCATION_LIST" with following values.

kitchen
bedroom
bathroom
dining area

工作正常。但是我需要从我自己的服务中动态添加更多位置值。

It's working fine. But I need to add more location values dynamically from my own service. Is it possible?

根据我的系统架构,我们无法预定义位置名称。那我该怎么办?

Based on my system architecture, we cant pre-defined the location names. Then what should i do?

推荐答案

是的,也许有可能完成您的要求。

Yes, it may be possible to accomplish what you are asking.

首先,让我们澄清一下广告位的工作原理。如 Alexa博客文章:

First, let's clear something up about how slots work. As described in this Alexa blog post:


当您创建自定义广告位类型时,要理解的一个关键概念是这是Alexa的训练数据NLP(自然语言处理),您提供的值不是限制用户可以说的严格的枚举或数组,这有两个含义1)不在您的广告位值中的单词和短语将被传递给您,2)您的代码如果说的是未知的,则需要执行所需的任何验证。

"When you create a custom slot type, a key concept to understand is that this is training data for Alexa’s NLP (natural language processing). The values you provide are NOT a strict enum or array that limit what the user can say. This has two implications 1) words and phrases not in your slot values will be passed to you, 2) your code needs to perform any validation you require if what’s said is unknown."

这意味着您可以在插槽中接收单词您没有在SLOT定义中明确列出。因此,您只需要在SLOT列表中提供足够的单词示例即可帮助Alexa NLP引擎。

What this means is that you CAN receive words in the slot that you did not specifically list in the SLOT definition. So you just need to provide enough word examples in the SLOT list to help the Alexa NLP engine.

我建议您尝试使用当前的实现,并尝试替代其他实现位置,看看Alexa是否可以识别并退回它。尝试将插槽值写入日志并查看。您可能会感到惊喜。

I suggest that you experiment with your current implementation, and try substituting a different location and see if Alexa can recognize and return it. Try writing the slot value to the log and see. You may be pleasantly surprised.

这篇关于如何为Alexa技能动态添加广告位值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆