我的自定义槽类型采用了意外值

编程入门 行业动态 更新时间:2024-10-08 00:34:43
本文介绍了我的自定义槽类型采用了意外值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在使用 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.

更多推荐

我的自定义槽类型采用了意外值

本文发布于:2023-11-28 04:33:39,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1640981.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:采用了   自定义   意外   类型

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!