简体   繁体   English

沃森对话:向用户显示所有实体

[英]Watson Conversation: Show user all entities

In Watson conversation. 在Watson对话中。 I have an entity Fruit 我有实体水果

Fruit values:
    -Apple     
    -Orange
    -Banana
    -Kiwi

I'd like to create a new dialog where the intent of the user is to get a list of all the values of a specific entity, in this case a list of all the fruits, . 我想创建一个新对话框,用户的意图是获取特定实体的所有值的列表,在本例中为所有水果的列表。 So the conversation should go: 因此对话应该进行:

User: "What fruits do you have?"

And then I'd like Watson to respond 然后我希望沃森做出回应

Watson: "The fruits we got in store are: Apple, Orange, Banana, Kiwi"

All the stuff I found is of recognizing an entity in users input, such as 我发现的所有内容都是在用户输入中识别实体,例如

User: "Do you have apples?"

And Watson picking up Apples 沃森拿起苹果

Just to clarify , setting an array with the possible options declarativly on a context variable as shown below is no good for me, I need to get them dynamically from the entity 只是澄清一下,如下所示,在上下文变量上声明一个带有可能选项的数组对我没有好处,我需要从实体中动态获取它们

{
  "context": {
    "fruits": [
      "lemon",
      "orange",
      "apple"
    ]
  },
  "output": {
    "text": {
      "values": [
        "This is the array: <? $fruits.join(', ') ?>"
      ],
      "selection_policy": "sequential"
    }
  }
}

Thankss! Thankss!

AFAIK it is not possible to directly access the workspace metadata from within a dialog. AFAIK无法从对话框中直接访问工作空间元数据。 You have access to what was detected using the intents, entities and context variables. 您可以访问使用Intent,实体和上下文变量检测到的内容。 However, I see two options you have: 但是,我看到您有两个选择:

  1. Use your application program that drives the chat to access the entity definitions on the fly, then create a context variable in which you offer the entity choices. 使用驱动聊天的应用程序即时访问实体定义,然后创建一个上下文变量,您可以在其中提供实体选择。 The API to list entities can be used from any programming language and there are SDKs. 可以通过任何编程语言使用列出实体API,并且有SDK。
  2. With a relatively new feature you can invoke server or client actions from within a dialog node , ie, make programmatic calls. 使用相对较新的功能,您可以从对话框节点内调用服务器或客户端操作 ,即进行编程调用。 Use that and the API mentioned above to obtain the list of entity values. 使用该名称和上面提到的API可获得实体值的列表。

.

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

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