Last active
June 22, 2016 14:41
-
-
Save plindberg/61fef6b1999b58855b54c475737b0564 to your computer and use it in GitHub Desktop.
A minimal example of a Watson Dialog XML script with an inline Javascript function.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8" ?> | |
<dialog xsi:noNamespaceSchemaLocation="WatsonDialogDocument_1.0.xsd" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |
<flow> | |
<folder label="Main"> | |
<output id="start"> | |
<prompt> | |
<item>Write stuff and I’ll SHOUT it back to you.</item> | |
</prompt> | |
</output> | |
<getUserInput> | |
<input> | |
<grammar> | |
<item>(ANYTHING)={anything}</item> | |
</grammar> | |
<function> | |
<script> | |
Name=Calculate | |
Line="{anything.source}!!!".toUpperCase() | |
</script> | |
<action varName="anything" operator="SET_TO">{MCT:CUSTOM:Calculate:value}</action> | |
<output> | |
<prompt> | |
<item>{anything}</item> | |
</prompt> | |
</output> | |
</function> | |
</input> | |
</getUserInput> | |
</folder> | |
</flow> | |
<entities> | |
<entity name="ANYTHING"> | |
<value> | |
<grammar> | |
<item>!.*</item> | |
</grammar> | |
</value> | |
</entity> | |
</entities> | |
<variables> | |
<var_folder name="Home"> | |
<var name="anything" type="TEXT" /> | |
</var_folder> | |
</variables> | |
</dialog> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment