[英]Alexa custom intent accepts values which are not stored in the possible slot.values that should trigger it
I have an intent that gets triggered if the user asks Alexa to play one of the radios that I have provided in the JSON file for the slot {radio}
on the Alexa console. 如果用户要求Alexa播放我在JSON文件中为Alexa控制台上的
{radio}
插槽提供的电台之一,就会触发我的意图。 However, if the user asks Alexa to play "random_english_words", the intent works too. 但是,如果用户要求Alexa播放“ random_english_words”,则该意图也有效。
To simplify here's what happens: 为简化起见,将发生以下情况:
-User: Alexa play A better radio
-Alexa: I will play A better radio
=> Alexa does her job just fine.
-User: Alexa play what the Movie
-Alexa: I will play what the Movie
Alexa should send an error because "what the Movie" is not a possible radio name in the radio_slot
values. Alexa应该发送错误,因为在
radio_slot
值中“ what the Movie”不是一个可能的无线电名称。 But wait this gets even weirder. 但是等等,这变得更加奇怪。
User: Alexa play aenjaejfn
Alexa: There was a problem with the requested skill's response
Alexa does her job fine since aenjaejfn is NOT a possible radio name in the radio_slot values. Alexa的工作很好,因为aenjaejfn在radio_slot值中不是一个可能的无线电名称。
So I have two questions: 所以我有两个问题:
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).
创建自定义插槽类型时,要理解的关键概念是这是Alexa NLP(自然语言处理)的训练数据。 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,
1)不在您的广告位值中的单词和短语会传递给您,
2) your code needs to perform any validation you require if what's said is unknown.
2)如果未知,您的代码需要执行所需的任何验证。
Since you know the acceptable values for that slot, always perform a slot-value validation on your code. 由于您知道该插槽的可接受值,因此请始终对代码执行插槽值验证。 In this way when you get something like "aenjaejfn" or something which you dont support, you can always politely respond back like
这样,当您收到类似“ aenjaejfn”之类的内容或不支持的内容时,您总是可以礼貌地回覆
"Sorry I didn't understand, can you repeat"
“对不起,我听不懂,你能再说一遍吗”
or 要么
"Sorry we dont have aenjaejfn in our list. can you please select something from [give some samples from your list]"
“很抱歉,我们的清单中没有aenjaejfn。能否请您从[提供清单中的一些示例]中进行选择?”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.