Save user input (string) in Watson assistant

巧了我就是萌 提交于 2019-12-11 06:07:40

问题


I'm building a chat-bot application based on IBM Watson. I need to save the user input into a variable.

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.

How can I do so?


回答1:


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:

  1. 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.
  2. Use the value of the input variable. Thereafter, extract the identifier by applying string methods.

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.




回答2:


User input can be accessed as a String by this expression: <?input.text?>



来源:https://stackoverflow.com/questions/58049981/save-user-input-string-in-watson-assistant

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!