在使用 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.
更多推荐
我的自定义槽类型采用了意外值
发布评论