├── LICENSE ├── Notice.txt ├── README.md └── workspaces └── simple-variables.json /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /Notice.txt: -------------------------------------------------------------------------------- 1 | This product includes software originally developed by IBM Corporation 2 | Copyright 2017 IBM Corp. 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Using variables with IBM Watson Assistant (formerly Conversation) service 2 | The [IBM Watson Assistant (Conversation) service](https://cloud.ibm.com/docs/services/assistant?topic=assistant-index) on [IBM Cloud](http://www.ibm.com/cloud) is the foundation for building powerful chatbots and dialog-based systems. Core to its flexibility and versatility is a programming API and the ability to pass variables through the cognitive system. It supports user-provided context variables, allows the access to identified intents and entities including the annotations (what was the system thinking). Moreover, it features predefined system entities which can be enabled and significantly simplify detection of numbers, locations, people, dates and more within the ongoing conversation. 3 | 4 | In this repository we are going to collect samples that demonstrate how those variables and metadata can be put to productive work. 5 | 6 | The samples and the general syntax are described in the following blog posts. They can serve as additional source of information: 7 | * [Building chatbots: more tips and tricks](https://www.ibm.com/blogs/bluemix/2017/06/building-chatbots-tips-tricks/) 8 | * [More Tips and Tricks for Building Chatbots](https://blog.4loeser.net/2017/06/more-tips-and-tricks-for-building.html) 9 | * [Chatbots: Some tricks with slots in conversations](https://www.ibm.com/blogs/bluemix/2018/02/chatbots-some-tricks-with-slots-in-ibm-watson-conversation/) 10 | * [Lively chatbots: Best Practices ](https://www.ibm.com/blogs/bluemix/2017/07/lively-chatbots-best-practices/) 11 | 12 | Tutorial: 13 | * [Build a database-driven Slackbot](https://cloud.ibm.com/docs/solution-tutorials?topic=solution-tutorials-slack-chatbot-database-watson) 14 | 15 | # Samples 16 | The following sample scenarios demonstrate how context variables, intents and entities including system entities can be used for customized dialogs. 17 | 18 | - [Using variables with IBM Watson Assistant (formerly Conversation) service](#using-variables-with-ibm-watson-assistant-formerly-conversation-service) 19 | - [Samples](#samples) 20 | - [Access to system entities](#access-to-system-entities) 21 | - [Working with Currency](#working-with-currency) 22 | - [Nested evaluation of variables](#nested-evaluation-of-variables) 23 | - [Conditions and predicates in the response](#conditions-and-predicates-in-the-response) 24 | - [Replaced Markers](#replaced-markers) 25 | - [Random output from variables](#random-output-from-variables) 26 | - [Zeroes at the Slots](#zeroes-at-the-slots) 27 | - [Slack URIs as variables](#slack-uris-as-variables) 28 | - [Context Variable Defined](#context-variable-defined) 29 | - [Delete Context Variables](#delete-context-variables) 30 | - [Collection Projection](#collection-projection) 31 | - [Documentation and Resources](#documentation-and-resources) 32 | - [License](#license) 33 | - [Contribute / Contact Information](#contribute--contact-information) 34 | 35 | ### Access to system entities 36 | The IBM Watson Assistant service supports several system entities. They are predefined entities which can be enabled to allow simple identification of typical user input. The following response string shows how the entities can be accessed to form an answer. 37 | 38 | Response string: 39 | `All of entities: . They include "sys-location" (), "sys-date" (), "sys-number" (), "sys-person" () and more` 40 | 41 | Input: 42 | `How is the weather today in San Francisco and in Germany. Will it be over 20? Henrik and family want to go outside` 43 | 44 | Returned: 45 | > All of 5 entities: San Francisco, Germany, Henrik, 2017-06-19, 20. They include "sys-location" (San Francisco, Germany), "sys-date" (2017-06-19), "sys-number" (20), "sys-person" (Henrik) and more 46 | 47 | The example is part of the [`simple-variables.json`](workspaces/simple-variables.json) workspace file. You can import the file as new workspace into IBM Watson Conversation. 48 | 49 | ### Working with Currency 50 | In this example a condition first checks that a system entity `sys-currency` is present, then that exactly two currency values are included in the user input and, as third condition, that the currency units match. In the response string the two entered values are added. 51 | 52 | Condition: 53 | `entities['sys-currency'] && entities['sys-currency'].size()==2 && entities['sys-currency'][0].unit==entities['sys-currency'][1].unit` 54 | 55 | Response string: 56 | `You have ` 57 | 58 | Input: 59 | `I have 20 USD and $24` 60 | 61 | Returned: 62 | > You have 54.0 USD 63 | 64 | ### Nested evaluation of variables 65 | Sometimes it is necessary to first evaluate one variable and then use the result as input to another evaluation. In some programming / scripting language there is a special method or operator for this. An example is the [`eval` function](https://docs.python.org/3.5/library/functions.html#eval) in Python. But how can you do something like this in Watson Assistant? There, evaluations are done inside the [`` expression](https://cloud.ibm.com/docs/services/assistant?topic=assistant-dialog-methods). 66 | 67 | 68 | The upper dialog node consists of an empty response (output). Only the context is evaluated and a new value assigned to the variables `access` and `result` (based on a computation): 69 | ``` 70 | { 71 | "context": { 72 | "access": "", 73 | "result": "" 74 | }, 75 | "output": {} 76 | } 77 | ``` 78 | 79 | A subnode with the following response performs the second set of evaluations. It uses `access` and `result` as input. 80 | `This is my nested response: . The result is .` 81 | 82 | If the dialog input is `nested 8` and there is an existing context with `myproperties.one="one"` and `myproperties.two=2`, the following result is returned: 83 | > This is my nested response: one. The result is 32. 84 | 85 | ### Conditions and predicates in the response 86 | Dialog nodes in IBM Watson Conversation allow to check conditions (or predicates). Conditions control whether the node qualifies. Conditions can also be placed ahead of a response block inside a dialog node. In addition to that, conditions can even be placed and evaluated inside individual responses. 87 | 88 | The following is a reponse string. It checks whether the location of entities in the input string and then returns one of two strings. It uses condensed `ìf-then-else` logic, a so-called [ternary operator](http://docs.spring.io/spring/docs/current/spring-framework-reference/html/expressions.html): 89 | ``` 90 | 92 | ``` 93 | Note that you can nest the expressions (if first expression, then do, else evaluate next expression): 94 | ``` 95 | { 96 | "context": { 97 | "number1": "" 99 | } 100 | } 101 | ``` 102 | 103 | ### Replaced Markers 104 | An alternative to embedding expressions into responses is to use special markers in the regular text: 105 | ``` 106 | Hello USER_NAME, it is CURRENT_TIME. 107 | ``` 108 | 109 | The application code would then search for and replace the designated markers with information carried in the application. This could be overall simpler to do, especially when more complex data and structures are retrieved from backend systems and more sophisticated formatting and processing of that data is needed. 110 | ``` 111 | Hello Henrik, it is 16:54:31. 112 | ``` 113 | A simple example of the above can be seen in the [TJBot "Tell the time" recipe](https://github.com/damiancummins/tell_the_time). In the function [`tellTheTime`](https://github.com/DamianCummins/tell_the_time/blob/master/tellTheTime.js) the marker `todays_date` is replaced with the current time for a specific timezone. 114 | 115 | In an advanced version of using markers, the entire response only consists of a marker. It would be replaced by the application by an answer that, maybe, is retrieved from a database or built from a template and data coming from various systems. The Watson Conversation Service would analyze and process the user input, but only return with a hint (the marker) on how to answer. 116 | ``` 117 | PROVIDE_TIME 118 | ``` 119 | The above could be turned into: 120 | ``` 121 | Hello Henrik, it is 16:54:31. 122 | ``` 123 | ### Random output from variables 124 | Sometimes, when using context variables or system metadata, you want to use a random (or other) portion of it in a response or when assigning a context variable. The following code shows how a mathematical function, here `random()`, is used to obtain an array entry and insert it into the response text: 125 | ``` 126 | Here is a random entity: 127 | 128 | ``` 129 | In the code the global entity array as part of the dialog metadata is used. A random number within the range of the array size is computed. The entity value is then accessed and printed. 130 | 131 | ### Zeroes at the Slots 132 | [Slots](https://cloud.ibm.com/docs/services/assistant?topic=assistant-dialog-slots) are a great way to gather several pieces of information and to easily declare what is needed. However, sometimes "ease of use" and (mathematical) logic are not friendly to each other. The following is such an example: [Waiting for `@sys-number` to accept a `0` (zero)](https://stackoverflow.com/questions/45302644/ibm-watson-slots-wont-accept-0) 133 | 134 | The condition `@sys-number` is in fact a short hand syntax for condition `entities['sys-number'].value`. When `0` is sent the condition is evaluated to `false` as `0` is treated as a `false` by the expression language evaluator in Watson Assistant. Now this is not a desired behavior in this case. To prevent this, you can use `entities['sys-number']` in the condition that will return `true` every time `@sys-number` entity is recognized in the input. The [Assistant documentation has some related usage tips](https://cloud.ibm.com/docs/services/assistant?topic=assistant-system-entities). 135 | 136 | ### Slack URIs as variables 137 | I have been using Slack integrations with Watson Assistant. When trying to retrieve and identify URIs, e.g. web addresses or email addresses, coming from Slack as a patterned entity, I initially failed. The reason is that Slack formats the URIs into a style like ``. Thus, I am using the following pattern to define email and web address entities: `<[A-Za-z0-9._|:%@\/]+>`. 138 | 139 | ### Context Variable Defined 140 | Sometimes it is not clear whether a certain value or context variable has been entered. One example is when working with slots and a handler is used to exit the input process. To check whether a context variable has been defined and to give a conditional answer, the following check can be used: 141 | ``` 142 | "" 143 | ``` 144 | The question mark checks for existence and if present processes the first answer and, if not, the second option. 145 | 146 | ### Delete Context Variables 147 | At the end of processing input it often is necessary to clean up or reset the processing environment. This can be done by setting context variables to empty or null values. However, it is quite effective to [remove the variable](https://cloud.ibm.com/docs/services/assistant?topic=assistant-dialog-runtime#dialog-runtime-context-delete), so the environment is fresh again: 148 | ``` 149 | { 150 | "output": { 151 | "text": {}, 152 | "deleted": " " 153 | } 154 | } 155 | ``` 156 | UPDATE: 157 | 158 | 159 | For those on recent API versions of Watson Assistant: 160 | 161 | Set the variable to null. Here is the doc on ["Deleting a context variable"](https://cloud.ibm.com/docs/services/assistant?topic=assistant-dialog-runtime#dialog-runtime-context-delete). 162 | ``` 163 | { 164 | "context": { 165 | "myvariable": null 166 | } 167 | } 168 | ``` 169 | 170 | ### Collection Projection 171 | A [collection projection](https://cloud.ibm.com/docs/services/assistant?topic=assistant-dialog-methods#dialog-methods-collection-projection), by definition, extracts a subcollection from an array of values. The operator is denoted with a `!` and is useful in many ways. 172 | 173 | The following expression as part of an output object would print an array of the detected entity values for **myentity**. 174 | ``` 175 | { "text": ""} 176 | ``` 177 | 178 | This expression would assign a comma-separated list of the words (literals) that are part of the input message: 179 | ``` 180 | { 181 | "context": { 182 | "myvariable": "" 183 | } 184 | } 185 | ``` 186 | 187 | # Documentation and Resources 188 | Here are some useful links to documentation and other resources: 189 | * Watson Assistant service: https://cloud.ibm.com/docs/services/assistant?topic=assistant-getting-started 190 | * Watson Assistant service, expression language: https://cloud.ibm.com/docs/services/assistant?topic=assistant-dialog-methods 191 | * Python SDK, Watson Developer Cloud: https://github.com/watson-developer-cloud/python-sdk 192 | * Node SDK, Watson Developer Cloud: https://github.com/watson-developer-cloud/node-sdk 193 | * Java SDK, Watson Developer Cloud: https://github.com/watson-developer-cloud/java-sdk 194 | 195 | # License 196 | See [LICENSE](LICENSE) for license information. 197 | 198 | The samples are provided on a "as-is" basis and are un-supported. Use with care... 199 | 200 | # Contribute / Contact Information 201 | If you have found errors or some instructions are not working anymore, then please open an GitHub issue or, better, create a pull request with your desired changes. 202 | -------------------------------------------------------------------------------- /workspaces/simple-variables.json: -------------------------------------------------------------------------------- 1 | { 2 | "status": "Available", 3 | "intents": [ 4 | { 5 | "description": null, 6 | "intent": "something", 7 | "examples": [ 8 | { 9 | "text": "What is the weather today?", 10 | "updated": "2017-06-27T09:16:56.899Z", 11 | "created": "2017-06-27T09:16:56.899Z" 12 | }, 13 | { 14 | "text": "How is the weather today?", 15 | "updated": "2017-06-27T09:16:56.899Z", 16 | "created": "2017-06-27T09:16:56.899Z" 17 | }, 18 | { 19 | "text": "Will it rain?", 20 | "updated": "2017-06-27T09:16:56.899Z", 21 | "created": "2017-06-27T09:16:56.899Z" 22 | }, 23 | { 24 | "text": "Will there be sunshine tomorrow?", 25 | "updated": "2017-06-27T09:16:56.899Z", 26 | "created": "2017-06-27T09:16:56.899Z" 27 | }, 28 | { 29 | "text": "Is it ok to wear sandals?", 30 | "updated": "2017-06-27T09:16:56.899Z", 31 | "created": "2017-06-27T09:16:56.899Z" 32 | }, 33 | { 34 | "text": "Rain or shine?", 35 | "updated": "2017-06-27T09:16:56.899Z", 36 | "created": "2017-06-27T09:16:56.899Z" 37 | }, 38 | { 39 | "text": "What is up", 40 | "updated": "2017-06-27T09:16:56.899Z", 41 | "created": "2017-06-27T09:16:56.899Z" 42 | }, 43 | { 44 | "text": "How are you today?", 45 | "updated": "2017-06-27T09:16:56.899Z", 46 | "created": "2017-06-27T09:16:56.899Z" 47 | }, 48 | { 49 | "text": "Tell me about you", 50 | "updated": "2017-06-27T09:16:56.899Z", 51 | "created": "2017-06-27T09:16:56.899Z" 52 | }, 53 | { 54 | "text": "I have money", 55 | "updated": "2017-06-27T09:16:56.899Z", 56 | "created": "2017-06-27T09:16:56.899Z" 57 | }, 58 | { 59 | "text": "I earned money", 60 | "updated": "2017-06-27T09:16:56.899Z", 61 | "created": "2017-06-27T09:16:56.899Z" 62 | }, 63 | { 64 | "text": "My timezone is CEST", 65 | "updated": "2017-06-27T09:16:56.899Z", 66 | "created": "2017-06-27T09:16:56.899Z" 67 | } 68 | ], 69 | "created": "2017-06-27T09:16:56.899Z" 70 | } 71 | ], 72 | "name": "Variables", 73 | "language": "en", 74 | "description": "testing context variables and system entities", 75 | "entities": [ 76 | { 77 | "updated": "2017-06-27T09:16:56.899Z", 78 | "description": null, 79 | "created": "2017-06-27T09:16:56.899Z", 80 | "entity": "weather", 81 | "values": [ 82 | { 83 | "updated": "2017-06-27T09:16:56.899Z", 84 | "metadata": null, 85 | "synonyms": [], 86 | "value": "temperature", 87 | "created": "2017-06-27T09:16:56.899Z" 88 | }, 89 | { 90 | "updated": "2017-06-27T09:16:56.899Z", 91 | "metadata": null, 92 | "synonyms": [], 93 | "value": "sunshine", 94 | "created": "2017-06-27T09:16:56.899Z" 95 | }, 96 | { 97 | "updated": "2017-06-27T09:16:56.899Z", 98 | "metadata": null, 99 | "synonyms": [ 100 | "downpour", 101 | "drizzle", 102 | "snow" 103 | ], 104 | "value": "rain", 105 | "created": "2017-06-27T09:16:56.899Z" 106 | } 107 | ], 108 | "metadata": null 109 | }, 110 | { 111 | "updated": "2017-06-27T09:16:56.899Z", 112 | "description": null, 113 | "created": "2017-06-27T09:16:56.899Z", 114 | "entity": "sys-person", 115 | "values": [], 116 | "metadata": null 117 | }, 118 | { 119 | "updated": "2017-06-27T09:16:56.899Z", 120 | "description": null, 121 | "created": "2017-06-27T09:16:56.899Z", 122 | "entity": "money", 123 | "values": [ 124 | { 125 | "updated": "2017-06-27T09:16:56.899Z", 126 | "metadata": null, 127 | "synonyms": [ 128 | "cash" 129 | ], 130 | "value": "money", 131 | "created": "2017-06-27T09:16:56.899Z" 132 | }, 133 | { 134 | "updated": "2017-06-27T09:16:56.899Z", 135 | "metadata": null, 136 | "synonyms": [ 137 | "pesos", 138 | "dollar", 139 | "euro", 140 | "EUR" 141 | ], 142 | "value": "currency", 143 | "created": "2017-06-27T09:16:56.899Z" 144 | } 145 | ], 146 | "metadata": null 147 | }, 148 | { 149 | "updated": "2017-06-27T09:16:56.899Z", 150 | "description": null, 151 | "created": "2017-06-27T09:16:56.899Z", 152 | "entity": "sys-currency", 153 | "values": [], 154 | "metadata": null 155 | }, 156 | { 157 | "updated": "2017-06-27T09:16:56.899Z", 158 | "description": null, 159 | "created": "2017-06-27T09:16:56.899Z", 160 | "entity": "sys-location", 161 | "values": [], 162 | "metadata": null 163 | }, 164 | { 165 | "updated": "2017-06-27T09:16:56.899Z", 166 | "description": null, 167 | "created": "2017-06-27T09:16:56.899Z", 168 | "entity": "sys-date", 169 | "values": [], 170 | "metadata": null 171 | }, 172 | { 173 | "updated": "2017-06-27T09:16:56.899Z", 174 | "description": null, 175 | "created": "2017-06-27T09:16:56.899Z", 176 | "entity": "sys-number", 177 | "values": [], 178 | "metadata": null 179 | }, 180 | { 181 | "updated": "2017-06-27T09:16:56.899Z", 182 | "description": null, 183 | "created": "2017-06-27T09:16:56.899Z", 184 | "entity": "sys-percentage", 185 | "values": [], 186 | "metadata": null 187 | }, 188 | { 189 | "updated": "2017-06-27T09:16:56.899Z", 190 | "description": null, 191 | "created": "2017-06-27T09:16:56.899Z", 192 | "entity": "animals", 193 | "values": [ 194 | { 195 | "updated": "2017-06-27T09:16:56.899Z", 196 | "metadata": null, 197 | "synonyms": [], 198 | "value": "cat", 199 | "created": "2017-06-27T09:16:56.899Z" 200 | }, 201 | { 202 | "updated": "2017-06-27T09:16:56.899Z", 203 | "metadata": null, 204 | "synonyms": [], 205 | "value": "dog", 206 | "created": "2017-06-27T09:16:56.899Z" 207 | } 208 | ], 209 | "metadata": null 210 | }, 211 | { 212 | "updated": "2017-06-27T09:16:56.899Z", 213 | "description": null, 214 | "created": "2017-06-27T09:16:56.899Z", 215 | "entity": "sys-time", 216 | "values": [], 217 | "metadata": null 218 | } 219 | ], 220 | "counterexamples": [], 221 | "dialog_nodes": [ 222 | { 223 | "updated": "2017-06-27T13:21:45.337Z", 224 | "description": null, 225 | "parent": null, 226 | "title": null, 227 | "created": "2017-06-27T09:16:56.899Z", 228 | "dialog_node": "Something is happening", 229 | "previous_sibling": "Welcome", 230 | "context": { 231 | "num_entities": "" 232 | }, 233 | "output": { 234 | "text": { 235 | "values": [ 236 | "All of entities: . They include \"sys-location\" (), \"sys-date\" (), \"sys-number\" (), \"sys-person\" () and more. This is stored: ." 237 | ], 238 | "selection_policy": "random" 239 | } 240 | }, 241 | "metadata": null, 242 | "conditions": "#something", 243 | "go_to": null 244 | }, 245 | { 246 | "updated": "2017-06-27T09:16:56.899Z", 247 | "description": null, 248 | "parent": null, 249 | "title": null, 250 | "created": "2017-06-27T09:16:56.899Z", 251 | "dialog_node": "Welcome", 252 | "previous_sibling": null, 253 | "context": null, 254 | "output": { 255 | "text": { 256 | "values": [ 257 | "Hello. How can I help you?" 258 | ], 259 | "selection_policy": "sequential" 260 | } 261 | }, 262 | "metadata": null, 263 | "conditions": "welcome", 264 | "go_to": null 265 | }, 266 | { 267 | "updated": "2017-06-27T09:16:56.899Z", 268 | "description": null, 269 | "parent": null, 270 | "title": null, 271 | "created": "2017-06-27T09:16:56.899Z", 272 | "dialog_node": "Anything else", 273 | "previous_sibling": "Something is happening", 274 | "context": null, 275 | "output": { 276 | "text": { 277 | "values": [ 278 | "I didn't understand. You can try rephrasing.", 279 | "Can you reword your statement? I'm not understanding.", 280 | "I didn't get your meaning." 281 | ], 282 | "selection_policy": "sequential" 283 | } 284 | }, 285 | "metadata": null, 286 | "conditions": "anything_else", 287 | "go_to": null 288 | } 289 | ], 290 | "metadata": null 291 | } 292 | --------------------------------------------------------------------------------