【问题标题】:Alexa Intent Schema: Random input being identified as intentsAlexa Intent Schema:随机输入被识别为意图
【发布时间】:2017-08-13 08:24:00
【问题描述】:

我有两个使用相同插槽类型的意图。但是,如果输入是随机字符串,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-skills-kit alexa-skill alexa-voice-service


    【解决方案1】:

    有一个技巧可以解决这个问题:

    如果没有找到任何匹配项(随机字符串),亚马逊总是以最高的话语数为目标。 因此,我创建了一个意图“DidNotUnderstand”,并在结果中添加尽可能多的随机话语(足够温和),如果没有找到任何匹配,alexa 将调用“DidNotUnderstand”意图。

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

    【讨论】:

    • 您始终可以拥有“未处理”处理程序,该处理程序将从 canHandle() 函数返回“真”。然后你必须把这个处理程序放在 addRequestHandler() 函数中参数值的最后一个。
    【解决方案2】:

    在开发 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.

    上面的链接还有一些后续链接,进一步深入探讨了主题错误处理。

    【讨论】:

      【解决方案3】:

      根据documentation

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

      代码sn-p:

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

      【讨论】:

        【解决方案4】:

        具有 SearchQuery 槽类型的槽可能会对您有所帮助。但它需要一些额外的短语。就像

        Fname->其中 Fname 是 Amazon.SearchQuery 类型的插槽

        我的名字是{Fname}

        它适用于示例

        我的名字是 bffblselsk 我的名字是 snfdslnel 等等……

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

        【讨论】:

          猜你喜欢
          • 2019-01-05
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2023-03-12
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多