我有两个使用相同插槽类型的意图 . 但是,如果输入是随机字符串,则Alexa会自动识别其JSON请求中的意图,即使它不是话语的一部分 . 例如,在下面的示例中,如果用户输入为'bla bla bla',则 GetAccountBalance
被标识为没有插槽值的intent,即使它不是提供的话语的一部分 .
对这些情况进行错误检查的方法是什么?在开发意图模式时,避免这种情况的最佳做法是什么?有没有办法创建一个可以处理所有随机输入的意图?
示例架构:
{
"intents": [
{
"intent": "GetAccountBalance",
"slots": [
{
"name": "AccountType",
"type": "ACCOUNT_TYPE"
}
]
},
{
"intent": "GetAccountNumber",
"slots": [
{
"name": "AccountType",
"type": "ACCOUNT_TYPE"
}
]
}
]
}
话语:
GetAccountBalance what is my account balance for {AccountType} Account
GetAccountBalance what is my balance for {AccountType} Account
GetAccountBalance what is the balance for my {AccountType} Account
GetAccountBalance what is {AccountType} account balance
GetAccountBalance what is my account balance
GetAccountBalance what is account balance
GetAccountBalance what is the account balance
GetAccountBalance what is account balance
GetAccountNumber what is my account number for {AccountType} Account
GetAccountNumber what is my number for {AccountType} Account
GetAccountNumber what is the number for my {AccountType} Account
GetAccountNumber what is {AccountType} account number
GetAccountNumber what is my account number
GetAccountNumber what is account number
GetAccountNumber what is the account number
GetAccountNumber what is account number
4 回答
根据documentation:
当用户的口头输入与技能中的任何其他意图都不匹配时,将触发
AMAZON.FallbackIntent
(仅限英语(美国)) .AMAZON.FallbackIntent
与自动生成的域外模型匹配 .代码段:
在开发Alexa技能时,即使用户说纯粹的胡言乱语,Alexa也总是会选择一个触发的意图 . 据我所知,没有办法设置默认/全部捕获意图 .
在错误处理方面,文档中的以下段落非常重要 .
Note that a custom slot type is not the equivalent of an enumeration. Values outside the list are still returned if recognised by the spoken language understanding system. Although input to a custom slot type is weighted towards the values in the list, it is not constrained to just the items on the list. Your code still needs to include validation and error checking when using slot values.
上面的链接还有一些后续链接,进一步深入到主题错误处理 .
有一个黑客来解决这个问题:
如果没有找到任何匹配(随机字符串)亚马逊总是采取最高话语权的意图 . 所以我创建了一个意图'DidNotUnderstand',并在结果中添加尽可能多的随机话语(足够温和),如果没有找到任何匹配,alexa将调用'DidNotUnderstand'意图 .
请参考以下链接的第一个回复:https://forums.developer.amazon.com/questions/4856/intent-triggering-without-utterance-match.html
具有SearchQuery插槽类型的插槽可能对您有所帮助 . 但它需要一些额外的短语
Fname->其中Fname是Amazon.SearchQuery类型的插槽
我叫
它将适用于该示例
我的名字是bffblselsk我的名字是snfdslnel等...
访问Amazon.SearchQuery Slot以获取更多参考....