简体   繁体   English

大量实体的Watson Conversation对话框?

[英]Watson Conversation dialog for large number of entities?

I currently have a chat bot that has an entity for each stock symbol. 我目前有一个聊天机器人,每个股票代码都有一个实体。 There are over 3,000. 有超过3,000。 For my dialog I want to be able to detect questions like #get @price @stockSymbol. 对于我的对话,我希望能够检测到#get @price @stockSymbol等问题。 Is there a way to deal with a large number of entities without writing an if statement for each one? 有没有办法处理大量实体而不为每个实体编写if语句?

I am sorry to say there is no process within the Conversation Service UI that has an automatic dialog creation method. 很抱歉,Conversation Service UI中没有具有自动对话框创建方法的进程。 In cases like this, many teams create an external script that can read a file with your entities in it, and then creates a workspace json file with the required dialog nodes. 在这种情况下,许多团队创建一个外部脚本,可以读取包含其实体的文件,然后使用所需的对话节点创建工作区json文件。 The workspace json file is a relatively simple format, and I have found you can easy merge any new json file into an already created workspace. 工作区json文件是一种相对简单的格式,我发现您可以轻松地将任何新的json文件合并到已创建的工作区中。 In fact with the new API's it even possible to load the new elements into a running workspace. 事实上,使用新的API,甚至可以将新元素加载到正在运行的工作区中。 ( although if new to this, create a duplicate ws, and merge into this one, or download and merge via a good editor. ) (虽然如果对此有所了解,请创建一个重复的ws,并合并到这个,或通过一个好的编辑器下载和合并。)

You are only allowed to have 100 entities in a single workspace. 您只能在一个工作区中拥有100个实体。 However those entities can have 100,000 values. 但是,这些实体可以有100,000个值。

So you could create an entity called @StockSymbol and then each value would be the Stock identifier (eg. IBM). 因此,您可以创建一个名为@StockSymbol的实体,然后每个值都是Stock标识符(例如IBM)。

So you would only need one IF statement to determine it is a stock, then pass back the entity information to your calling application to take action on the value. 因此,您只需要一个IF语句来确定它是一个股票,然后将实体信息传回给您的调用应用程序以对该值执行操作。

To put this in programatically, if it is a one time thing you can create a CSV file like the following: 要以编程方式添加它,如果它是一次性的东西,您可以创建如下所示的CSV文件:

StockSymbol,IBM
StockSymbol,MSFT
StockSymbol,APPL

and so on. 等等。 Then import that entity file. 然后导入该实体文件。 Alternatively you can use the workspace API to update an already deployed workspace. 或者,您可以使用工作空间API更新已部署的工作空间。

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

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