没有枚举值的Amazon lex中的自定义广告位类型 [英] Custom slot types in amazon lex without enumeration values

查看:92
本文介绍了没有枚举值的Amazon lex中的自定义广告位类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试构建一个机器人来更改存储在数据库中的userinfo.

I'm trying to build a bot to change userinfo stored in a database.

我的第一个想法是创建两个插槽类型,例如{toChange}{newValue},用户可以在其中说将我的名字更改为Peter Griffin"或我的新电子邮件为user@mail.com".

My first thought was to create two slot types like {toChange} and {newValue} where the user could say "Change my name to Peter Griffin" or "My new email is user@mail.com".

结果证明Lex无法处理这些自定义字符串输入.我必须为用户可以拥有的每个值创建一个插槽类型:{name}AMAZON.Person{address}AMAZON.PostalAddress等等,然后让Lambda处理要引发的正确插槽.

Turns out Lex can't handle these custom string inputs. I had to create a slot type for each value the user can have: {name} with AMAZON.Person, {address} with AMAZON.PostalAddress and so on and let Lambda handle the correct slots to elicit.

问题是Lex不提供IBAN格式(也不是其他任何格式)的电子邮件或银行帐号的广告位类型.

The problem is that Lex does not offer slot types for email or an bankingaccount number in IBAN format (nor any other format).

如果我使用带有空枚举列表的自定义插槽类型,则只能输入文本,而不能输入数字.此外,还有空白和特殊字符(如).和@无法识别,Lex要求再次输入.

If I use a custom slot type with an empty enumeration list I can only enter text, not numbers. Furthermore blanks and special characterls like . and @ are not recognized and Lex asks for input again.

有什么办法可以做到这一点?我想到过这样的事情,例如在@之前先询问邮件的第一部分,然后再询问提供者,最后填写国家(地区)代码.但这远非易用.

Is there any way to accomplish this? I thought of something like asking for the first part of the mail before the @, then to ask for the provider and lastly filling in the country code. But that is far far away from being userfriendly.

在测试过程中,我发现到目前为止,AMAZON.PostalAddress并没有在Amazon方面进行验证.我可以输入任何我想要的内容,它将被接受,比如说一个电子邮件地址或一个帐号:twinkle:

During testing I found out there is no validation on Amazons side for AMAZON.PostalAddress as for now. I can literally type anything I want and it will be accepted, like lets say an email address or an account number :twinkle:

目前这种方法行之有效,但绝对不能保证将来会保持这种状态,所以我的问题仍然是未解决的.

For the moment this approach works fine, but there is absolutely no guarantee it will stay this way in the future, so my question still is open.

PS:这样,我可以使用{toChange}{newValue}遵循我的第一种方法,其中第一种是具有枚举值的自定义插槽类型,而第二种是AMAZON.PostalAddress插槽.

PS: Like this I was able to follow my first approach with {toChange} and {newValue}, where the first is a custom slot type with enumation values und the latter is a AMAZON.PostalAddress slot.

推荐答案

我这样做的方式是,
创建一个自定义广告位类型,例如

The way I did it was,
create a custom slot type like

{   "name": "emailAddressSlotType",
    "description": "see name",
    "enumerationValues": [
        { "value": "bobbySmith@yahoo.com" },
        { "value": "FreakyDonkeyLover@gmail.com" },
        { "value": "smithyBob@hotmail.com" }
    ]
}      

枚举值仅是示例电子邮件地址.然后,您需要使用LambdavalidationCodeHook之类的方法对其进行验证.
请参阅:这大概 ...我仍在研究我的

The enumeration values are just sample email addresses. You then need to validate it with something like a Lambda validationCodeHook.
see: this probably... i'm still working on mine

这篇关于没有枚举值的Amazon lex中的自定义广告位类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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