使用 Amazon Lex 的 inputTranscript 允许一个宽阔的开放槽

Using Amazon Lex's inputTranscript to allow for an wide open slot

任何人都可以提供关于如何使用 inputTranscript lex 事件将该输入作为其值反馈回插槽的任何见解,以允许开放插槽类型吗?我可以毫无问题地捕获用户输入,它只是将它作为我遇到问题的插槽值发回。从我的研究中可以看出,这是实现将任何值接受到插槽中的能力的最佳方法。我似乎无法真正让它发挥作用。我已经阅读了一些说明创建插槽,然后使用引出插槽功能的帖子,但没有任何内容非常详细。 谢谢

假设您的意图中有一个插槽 anyString
您需要做的第一件事是取消选中此广告位的 required 复选框。 现在在 选项 中,选择 Initialization and validation code hook 和 select 您的 Lambda 函数。 在 DialogCodeHook 中,我们可以使用以下代码获取用户输入并将其分配给我们的插槽 anyString

slots = intent_request['currentIntent']['slots']
slots['anyString'] = intent_request['inputTranscript']

您可以阅读更多关于 dialogAction here

希望对您有所帮助。