如何定义不是列表的自定义插槽类型? [英] How do I define a custom slot type that isn't a list?

查看:104
本文介绍了如何定义不是列表的自定义插槽类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Alexa技能套件(适用于Amazon Echo),并且想要创建一种技能,该技能会将意图发送给AWS Lambda函数,该函数将通过电子邮件将某些东西发回给我。

I'm playing around with the Alexa Skills Kit (for the Amazon Echo) and want to create a skill that would send the intent to an AWS Lambda function which would just email something back to me.

示例话语如下:

MemoIntent take a memo {myMemo}
MemoIntent to take a memo {myMemo}
MemoIntent send a memo {myMemo}

这样一来,我可以说 Alexa,请秘书秘书备忘,提醒我今天回家的路上去商店,然后从Lambda职能部门收到一封电子邮件,内容为提醒我去

This would allow me to say something like "Alexa, ask my secretary to take a memo, remind me to go to the store on my way home today" and would then get an email from my Lambda function saying, "remind me to go to the store on my way home today."

myMemo 插槽是自由格式的-此时只需一个句子或两种方法都可以,但是我没有在文档中找到有关如何为此类内容编写架构的大量帮助。目前,我的最佳猜测失败了:

The myMemo slot is freeform - at this point just a sentence or two will do, but I'm not finding a lot of help in the documentation for how to write the schema for something like this. My best guess at the moment fails with a:


错误:您的请求存在问题:未知的插槽名称
' {myMemo}。在
第1行的示例 MemoIntent记录备忘录{myMemo}中发生。

Error: There was a problem with your request: Unknown slot name '{myMemo}'. Occurred in sample 'MemoIntent take a memo {myMemo}' on line 1.

我正在使用AMAZON。 LITERAL插槽类型,文档不建议使用,但也没有提供其他建议。

I'm using the AMAZON.LITERAL slot type, which the documentation discourages, but it also doesn't offer any suggestions on how else to go about this. And besides, like I mentioned, it fails.

这里是失败的模式:

{
    "intents": [
        {
            "intent": "MemoIntent",
            "slots": [
                {
                    "name": "myMemo",
                    "type": "AMAZON.LITERAL"
                }
            ]
        }
    ]
}


推荐答案

文字与其他广告位类型不同如官方文档所述,您必须提供关于语音发音的培训:
https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/alexa-skills-kit-interaction-model-reference

Literals are different than other slot types in that you must provide training in the sample utterance, as mentioned in the official documentation: https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/alexa-skills-kit-interaction-model-reference

示例话语将用户可以说出的短语映射到您定义的意图。它们使用以下格式在纯文本文件中写为行:

Sample utterances map the phrases the user can speak to the intents you have defined. They are written as lines in a plain text file, using the following format:

IntentName  this is a sample utterance with no slots
IntentName  this is a sample utterance containing a {SlotName}
IntentName  this is a sample utterance containing a {SlotName} and {AnotherSlotName}

请注意,上述格式适用于AMAZON.LITERAL以外的所有广告位类型。对于AMAZON.LITERAL,您还需要指定一个示例广告位值:

IntentName  this is a sample utterance containing a {slot value|SlotName} using LITERAL

的{slot value | SlotName},或者,使用自定义插槽将允许您提供插槽在定义了许多示例自定义广告位值之后。在这种情况下,您将创建一个名为myMemo的新自定义插槽,其类型为自定义插槽名称,例如 MY_MEMO 。您的自定义广告位值将填充有可能的值(这些不是唯一的值),例如:

Alternatively, using Custom Slots will allow you to provide the slot after defining numerous sample custom slot values. In this scenario, you would create a new custom slot called myMemo with a type of the custom slot name, such as MY_MEMO. Your custom slot value would be populated with potential values (these are not the only values it will receive), such as:

walk the dog
eat more bacon
go to the store on the way home

这篇关于如何定义不是列表的自定义插槽类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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