Watson对话框动态数据变量输入/输出 [英] Watson Dialog Dynamic Data variable input/output
本文介绍了Watson对话框动态数据变量输入/输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试建立一个简单的对话框,用户将编写以下对话框:我的名字是Joe", 我希望对话框将userName变量设置为"Joe". 我找到了这个示例,但是响应始终是空字符串.
I'm trying to build a simple dialog that the user will write: "My name is Joe", and I want the Dialog to set a userName variable to "Joe". I found this example, but the response is always empty string.
<folder label="Main">
<output>
<prompt selectionType="RANDOM">
<item>Hello, What's your name?
</item>
</prompt>
</output>
<input id="input_2530402">
<grammar>
<item>My name is</item>
<item>my name is (DYNAMIC_DATA)={userName}</item>
<item>mine is (DYNAMIC_DATA)={userName}</item>
<item>(DYNAMIC_DATA)={userName} </item>
<item>(DYNAMIC_DATA)={userName} GiveName</item>
</grammar>
<action varName="userName" operator="SET_TO">{userName.source}</action>
<action varName="Defaulted_Previous" operator="SET_TO_NO"/>
<output>
<prompt>
<item>Hi {userName}!</item>
</prompt>
</output>
</input>
</folder>
变量定义:
<variables>
<var_folder name="Home">
<var name="agentName" type="TEXT" initValue="Alice"
description="The virtual agent's name." />
<var name="userName" type="TEXT" initValue="SomeName" description="The user's name" />
</var_folder>
</variables>
我不希望用户名输入与句子分开... 有什么建议吗?
I don't want the user name input to be seperated from the sentence... Any suggestions?
谢谢!
推荐答案
我最近做了类似的事情.也许会有所帮助:
I did something like this recently. Perhaps it will help:
https://github.com/codyburleson/watson-对话框/blob/master/dialogs/getUserNameAndRespond.xml
这篇关于Watson对话框动态数据变量输入/输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文