简体   繁体   English

如何在Watson Conversation中保存数据?

[英]How can I save a data in Watson Conversation?

I need save a data in Watson Conversation, for example: 我需要在Watson Conversation中保存数据,例如:

-Watson say: Hello, tell me your name 沃森说:你好,告诉我你的名字

-I say: My name is Isaac 我说:以撒

-Watson say: Ok Isaac, good night!** 沃森说:好的以撒,晚安!**

How can I save this value? 如何保存该值? Without telling Watson to say that when he recognizes Isaac's name. 无需告诉沃森说,当他识别出以撒的名字时。 Just keep that data that is "name" and show it. 只需保留作为“名称”的数据并显示它即可。 And to be able to use that variable that I keep the name of Isaac in other nodes 为了能够使用该变量,我将Isaac的名称保留在其他节点中

Thank you very much! 非常感谢你!

In this case you can use context variables or @sys-person (check Supported languages ) within Watson Conversation to do that. 在这种情况下,您可以在Watson Conversation中使用context variables或@ sys-person(选中“ 支持的语言” )。

Context variables with regex: 正则表达式的上下文变量:

And for get the name value, you need to use Regex to extract from the user input. 为了获得name值,您需要使用Regex从用户输入中提取。 And set it in all nodes that you want show the name of the user, for example. 例如,将其设置在要显示用户名的所有节点中。

{
  "context": {
    "name": "<? input.text.extract('yourRegextoExtractName')?>"
  },
  "output": {
    "text": {
      "values": [
        "Hi $name, how do you do?"
      ],
      "selection_policy": "sequential"
    }
  }
}

Note that I use the syntax to set the context variable: $name . 请注意,我使用syntax来设置上下文变量: $name So, just put in all nodes that you want show name the same syntax to set the name context variable. 因此, 只需在要显示名称所有节点中使用相同的语法来设置名称上下文变量即可。

@sys-person - System entities. @ sys-person-系统实体。

You can also active the @sys-person System entity, and use my example to save date below. 您也可以激活@ sys-person系统实体,并使用我的示例在下面保存日期。 Note that is BETA for now. 注意,现在是BETA。

For use @sys-person, active on: Entities -> System entities -> @sys-person, see my image anothers actives system-entity: 要使用@ sys-person,请在以下位置激活:实体->系统实体-> @ sys-person,请参见我的图片其他人激活的系统实体: 在此处输入图片说明

And your Conversation condition will be something like: 您的对话条件将类似于:

在此处输入图片说明

Result: 结果:

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM