在Watson Assistant中保存用户输入(字符串) [英] Save user input (string) in Watson assistant
问题描述
我正在基于IBM Watson构建一个聊天机器人应用程序.我需要将用户输入保存到变量中.
I'm building a chat-bot application based on IBM Watson. I need to save the user input into a variable.
我在网上搜索,仅找到输入内容必须为sys-(数字,日期,时间,位置,人)的教程.
I searched the web and I only found tutorials where the input must be of entity sys-(number, day, time, location, person).
在我的对话框中,我询问用户有关其标识符的信息.该标识符应为字母数字字符串.
In my dialog I ask the user about his identifier. This identifier should be an alphanumerical string.
我该怎么办?
推荐答案
Take a look at this IBM Cloud solution tutorial that creates a chatbot. It uses identifiers for emails, URIs and conferences.
我为您的案例提供了两种选择:
I see two options for your case:
- 定义实体类型标识符",并在其定义中使用模式.该模式将是字母数字正则表达式.对于插槽,将标识符"的实体分配为必要的输入.
- 使用应用字符串提取标识符方法.
- Define an entity type "identifier" and use a pattern in its definition. The pattern would be the alphanumerical regular expression. For a slot, assign the entity of "identifier" as necessary input.
- Use the value of the input variable. Thereafter, extract the identifier by applying string methods.
要访问检测到的实体中的实际值,请使用value
属性.请参阅 Watson Assistant文档,网址为实体属性以获取完整的语法和示例.
To access the actual value in a detected entity, use the value
property. See the Watson Assistant docs on entity properties for the full syntax and examples.
这篇关于在Watson Assistant中保存用户输入(字符串)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!