在Alexa Skill中处理重新提示时如何退回到错误 [英] How to fallback into error when reprompt is processed in Alexa Skill

查看:70
本文介绍了在Alexa Skill中处理重新提示时如何退回到错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是开发Alexa Skills的新手。我正在为西班牙商店开发Skill,所以我使用的是es-ES语音。我使用Node.js ASK-SDK,遇到了这个问题:

I'm new to developing Alexa Skills. I'm working on a Skill for the Spanish store, so I'm using the es-ES voice. I use the Node.js ASK-SDK and I've come across this issue:

当我尝试使用提示进行对话时,如果用户说胡言乱语,那不应该触发我的任何话语,我希望输入错误处理程序,因为它是canHandle == true的话,但实际结果是,Alexa检测到乱码并将其排序为正确的话语之一。我已经看到在美国境内您有AMAZON。Fallback可以防止此问题的发生,但是由于西班牙的SDK没有此功能,我该如何检测到这一点?

When I'm trying to develop a conversation with reprompt, if the user says gibberish, that shouldn't trigger any of my utterances, I expect to enter in the Error Handler, as it's the one with canHandle == true, but the actual result is that that gibberish is detected and sorted by Alexa as one of the correct utterances. I've seen that in en-US you have the AMAZON.Fallback to sort-of prevent this issue but as none of the Spanish SDK have this, how can I detect this?

我已经上传了一个演示项目来模拟这种行为

您可以尝试以下工作流程:

You can try with this the workflow:


  • 开始技能

  • 该技能返回第一文字并保持收听状态(出现提示时)

  • 您输入第二个数字

  • 该技能返回第二文本并继续提示另一个提示

  • 您说的是胡言乱语,例如 d或等等等等

  • 您按照明显随机的言语进行排序。

  • Start the Skill
  • The skill returns the "Number One" text and stays listening (as there's a reprompt)
  • You write number two
  • The skill returns the "Number Two" text and stays listening with another reprompt
  • You say gibberish, for example, "d" or "blah blah blah"
  • You are sorted on a apparently random utterance.

以下是 blah blah blah的JSON输入示例

Here's an example of the JSON input for "blah blah blah"

{
"version": "1.0",
"session": {
    "new": false,
    "sessionId": "amzn1.echo-api.session.55b928a6-ecb2-4b55-857e-af6a76dee6fe",
    "application": {
        "applicationId": "amzn1.ask.skill.dd0b7ffd-b408-489a-ab5e-a7d7b8d05da3"
    },
    "user": {
        "userId": "amzn1.ask.account.AFWPOWCRQULHUVKQTTX7JIS3O264CCHSUY4MPHCSJS4LKLQX45YARJ67LTGHPMS7RWUXVNYUTXT6JMT3DICTL5YZ7QHSLZ3QIHEKDP5YRPLCAEFXTD4BRY6WJIKC36UO3QU4F5X5BLFAGX6C3KN76MQJETO5PY6I65CVNOFBQLGNZ3P4YN4IOLYBCC7NDGAQ6LFAWMWTKT6DWQY"
    }
},
"context": {
    "System": {
        "application": {
            "applicationId": "amzn1.ask.skill.dd0b7ffd-b408-489a-ab5e-a7d7b8d05da3"
        },
        "user": {
            "userId": "amzn1.ask.account.AFWPOWCRQULHUVKQTTX7JIS3O264CCHSUY4MPHCSJS4LKLQX45YARJ67LTGHPMS7RWUXVNYUTXT6JMT3DICTL5YZ7QHSLZ3QIHEKDP5YRPLCAEFXTD4BRY6WJIKC36UO3QU4F5X5BLFAGX6C3KN76MQJETO5PY6I65CVNOFBQLGNZ3P4YN4IOLYBCC7NDGAQ6LFAWMWTKT6DWQY"
        },
        "device": {
            "deviceId": "amzn1.ask.device.AETBPXRLKFDMVR23WFUFQ3HOFTGHQDISLOQAPWS4BDBD4FAGXUKW2P56RJ3G74C75HG63MS52UV7KFYJAENEVT6VIRZUEKWCQQHNGV3FMP6BM3A5JZCUXH2LRYDHLQLBH5ABDJ7EYRWUI5532NYEZLUCYIGMRZCM2WKQ3XG6NX5VZPOELTKUO",
            "supportedInterfaces": {}
        },
        "apiEndpoint": "https://api.eu.amazonalexa.com",
        "apiAccessToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IjEifQ.eyJhdWQiOiJodHRwczovL2FwaS5hbWF6b25hbGV4YS5jb20iLCJpc3MiOiJBbGV4YVNraWxsS2l0Iiwic3ViIjoiYW16bjEuYXNrLnNraWxsLmRkMGI3ZmZkLWI0MDgtNDg5YS1hYjVlLWE3ZDdiOGQwNWRhMyIsImV4cCI6MTU0MjM1OTg1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": {
        "experiences": [
            {
                "arcMinuteWidth": 246,
                "arcMinuteHeight": 144,
                "canRotate": false,
                "canResize": false
            }
        ],
        "shape": "RECTANGLE",
        "pixelWidth": 1024,
        "pixelHeight": 600,
        "dpi": 160,
        "currentPixelWidth": 1024,
        "currentPixelHeight": 600,
        "touch": [
            "SINGLE"
        ]
    }
},
"request": {
    "type": "IntentRequest",
    "requestId": "amzn1.echo-api.request.fef2e2fc-b404-4729-85b4-e8ced71b6ecd",
    "timestamp": "2018-11-16T08:17:34Z",
    "locale": "es-ES",
    "intent": {
        "name": "NumberTwoIntent",
        "confirmationStatus": "NONE"
    }
}
}

如何防止这种情况?我希望输入该错误,因为它是唯一可以针对等等等等发声返回true的处理程序,因此,请告诉用户其语音存在错误,但是由于它是根据发声来分类的,因此,返回用户未要求的一些信息。

How can I prevent this? I'd expect to enter the error, as it's the only one handler that could return true for "blah blah blah" utterance and so, tell the user there's been an error for their speech, but as it's being classified on a utterance, it returns some information the user hasn't asked for.

谢谢

推荐答案

处理超出范围的推荐策略没有 FallbackIntent 仍要尽可能广泛地涉及模型确实可以处理和处理的意图。尝试识别人们可能想在领域之外询问您的技能,并以一种单独的意图来抓住它们,这些意图最终将为这些情况提供额外的答案。

The recommended strategy for handling out-of-domain utterances in locales that have no FallbackIntent yet is to be as extensive as possible with the intents that your model can indeed handle and try to recognize some utterances people might want to ask your skill outside the domain and catch them in a separate intent that ultimately will provide extra answers specifically for those cases.

建议是:


  1. 每个Intent提供7至50个语音,尝试提供代表性的语音样本以确保出于相同的目的,您会发现很多变化

  1. Provide between 7 and 50 utterances per Intent, try to provide a representative sample of utterances to make sure you'll catch a lot of variations for the same intent

请确保您没有不同的发音nt意图相同或相似(当模型选择意图时,这将提供不可预测的结果)

Make sure you don't have utterances in different intents that are the same or similar (this will provide unpredictable results when the model selects an intent)

如果意图中包含广告位,请对其进行验证并通知如果值不是您期望的值,则为用户。您可以在后端自行验证插槽,或者最近才添加,也可以通过对话框管理来验证插槽。请注意,您可以使用如果在验证失败后需要从用户那里获得有效的插槽值,则可基于以前的 answer-slots使用对话管理 rel = nofollow noreferrer>插槽引发

If your intent has slots, validate them and notify the user if the values are not what you'd expect. You can validate slots yourself in the back-end or, just added recently, you can also validate slots via dialog management. Note that you can use slot elicitation if you need to get a valid slot value from the user after validation fails

不要创建带有大量随机言语的意图,因为您可能会为此技能弄乱模型,也可能为此创建插槽。权衡是不值得的。如果您仍然想要解决办法,请尝试

Do not create intents with a lot of random utterances since you risk messing up the model for the skill, as would creating slots for that purpose. The trade off is not worth it. If you still want a workaround try this or this.

您可以创建一个意图来处理您可以预期的域外话语。例如,在美国,许多技能的意图是可以应付人们所说的 bla bla

You can create an intent to handle out-of-domain utterances that you can kind of anticipate. For example a lot of skills in en-US have an intent that can handle bla bla bla as people tend to say it

不要依赖捕获所有处理程序 canHandle()设置为始终返回true)可以帮助您解决此问题。一些示例使用 UnhandledIntentHandler 并误导人们以为域外语音将由它处理,如果没有 FallbackIntent 。同样,不要依赖通过 addErrorHandlers()添加的 ErrorHandler ,因为它只会在存在实际错误时触发不在try / catch内的代码

Do not rely on catch all handlers (canHandle() set to always return true) to help you with this. Some examples use an UnhandledIntentHandler and mislead people to think out-of-domain utterances will be handled by it which is not the case if there's no FallbackIntent. Similarly, do not rely on an ErrorHandler added via addErrorHandlers() as it will only trigger is there's an actual error in the code which is not inside a try/catch

只要 Amazon.FallbackIntent 可以在您的语言环境中实施,并摆脱您自己的域外意图和/或解决方法(如果有的话)

As soon as Amazon.FallbackIntent becomes available in your locale implement it and get rid of your own out-domain intents and/or workarounds if you have them

这篇关于在Alexa Skill中处理重新提示时如何退回到错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆