Alexa Intent Schema:随机输入被识别为意图

Alexa Intent Schema: Random input being identified as intents

我有两个使用相同槽类型的意图。但是,如果输入是随机字符串,Alexa 会自动识别其 JSON 请求中的意图,即使它不是话语的一部分。例如,在下面的示例中,如果用户输入是 'bla bla bla',则 GetAccountBalance 被识别为没有槽值的意图,即使它不是提供的话语的一部分。

对这些情况进行错误检查的方法是什么?在开发意图模式时避免此类情况的最佳做法是什么?有没有办法创建一个可以处理所有随机输入的意图?

示例架构:

{
  "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

在开发 Alexa 技能时,Alexa 总是会选择一个 intent 来触发,即使用户说的是纯粹的胡言乱语。据我所知,没有办法设置默认/包罗万象的意图。

在错误处理方面,文档中的以下段落非常重要。

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.

上面的 link 也有一些跟进 link 进一步深入主题错误处理。

有一种方法可以解决这个问题:

如果未找到任何匹配项(随机字符串)亚马逊始终采用最高话语数的意图。 所以我创建了一个意图 'DidNotUnderstand' 并在结果中添加尽可能多的随机话语(足够适度)如果没有找到任何匹配 alexa 将调用 'DidNotUnderstand' 意图。

请参考下面第一个回复link: https://forums.developer.amazon.com/questions/4856/intent-triggering-without-utterance-match.html

SearchQuery 槽类型的槽可能会有所帮助 you.but 它需要一些额外的短语 it.like

Fname->其中 Fname 是 Amazon.SearchQuery

类型的插槽

我叫{Fname}

它适用于示例

我叫 bffblselsk 我的名字是 snfdslnel 等...

访问Amazon.SearchQuery插槽以获得更多参考....

根据 documentation

当用户的语音输入与技能中的任何其他意图不匹配时,将触发 AMAZON.FallbackIntent(仅提供英语(美国))。 AMAZON.FallbackIntent 与自动生成的域外模型相匹配。

代码片段:

'AMAZON.FallbackIntent': function (intent, session, response) {
    response.ask("Optimus Prime didn't get that one....","");
}