如果您提供项目ID,我有一个Python编码的后端,它提供了“获取项目的所有任务”的API。
我想使用来自AWS在线工具的Lex和Lambda来做这个请求,所以我想到了一些简单的事情:“给我项目145的任务”然后lambda用变量“145”调用API并且向用户显示任务。
我做了pizzaOrder教程,一切都很清楚,但现在我想用我的项目做这个基本的事情,我遇到了一个问题:我的项目不在插槽中,因为显然用户可以创建和删除项目。所以“145”不在插槽中。
那么如何应对这种情况呢? Lex可以识别出一个不在插槽中的单词然后像变量一样使用它吗?
答案 0 :(得分:3)
Short answer: Yes. Lex/Alexa can recognize words out of the defined values for a custom slot type.
This is taken from the documentation (Applies both to Alexa and Lex):
A custom slot type is not the equivalent of an enumeration. Values outside the list are still returned if recognized 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.