我的自定义广告位类型呈现意外值 [英] My custom slot type is taking on unexpected values

查看:100
本文介绍了我的自定义广告位类型呈现意外值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Alexa技能套件测试交互模型时,我发现了一些奇怪的事情。

I noticed something strange when testing my interaction model with the Alexa skills kit.

我定义了一个自定义广告位类型,例如:

I defined a custom slot type, like so:

CAR_MAKERS Mercedes | BMW | Volkswagen

我的意图方案是这样的:

And my intent scheme was something like:

{
  "intents": [
    {
      "intent": "CountCarsIntent",
      "slots": [
        {
          "name": "CarMaker",
          "type": "CAR_MAKERS"
        },
   ...

带有示例语音,例如:

CountCarsIntent Add {Amount} cars to {CarMaker}

现在,在开发者控制台中进行测试时,我注意到我可以这样写:

Now, when testing in the developer console, I noticed that I can write stuff like:

"Add three cars to Ford"

它实际上可以正确解析它!即使在交互模型中从未提到过福特! lambda请求为:

And it will actually parse this correctly! Even though "Ford" was never mentioned in the interaction model! The lambda request is:

  "request": {
    "type": "IntentRequest",
    ...
    "intent": {
      "name": "CountCarsIntent",
      "slots": {
        "CarMaker": {
          "name": "ExpenseCategory",
          "value": "whatever"
        },
 ...

这真的让我感到惊讶,因为自定义广告位类型非常清楚,该广告位只能采用交互模型中列出的值。

This really surprises me, because the documentation on custom slot types is pretty clear about the fact that the slot can only take the values which are listed in the interaction model.

现在,似乎还可以动态解析值!

Now, it seems that values are also parsed dynamically! Is this a new feature, or am I missing something?

推荐答案

实际上,这是正常现象(也是IMO)。 Alexa使用您提供的单词列表作为指南,而不是确定的列表。

Actually that is normal (and good, IMO). Alexa uses the word list that you provide as a guide, not a definitive list.

如果它没有这种灵活性,则无法知道用户是否使用了您意料之外的单词。这样,您就可以学习和改进列表和处理方式。

If it didn't have this flexibility then there would be no way to know if users were using words that you weren't expecting. This way you can learn and improve your list and handling.

这篇关于我的自定义广告位类型呈现意外值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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