【发布时间】:2017-10-09 21:58:58
【问题描述】:
我正在尝试在我的 AIML 文件中添加条件标记功能。 我正在使用带有 PyAIML 和 pb_py 库的 python 脚本。
在我当前的实现中,我设置了它,以便我可以在我的 python 脚本中动态设置谓词值,以便条件标记为“语音”或“文本”:
<!-- 5 Legacy -->
<category><pattern>ARE YOU NAMED AFTER *</pattern><template><srai>legacyresponse</srai></template></category>
<category><pattern>WHO ARE YOU NAMED AFTER</pattern><template><srai>legacyresponse</srai></template></category>
<category><pattern>LEGACYRESPONSE</pattern>
<template>
<condition name = "inputtype">
<li value = "speech">Some response</li>
<li value = "text">Some text response.</li>
</condition>
<srai>promptuser</srai>
</template>
</category>
在我的 AIML 文件中,我实现了多个响应功能,如下所示:
<category><pattern>_ YOUR DAD *</pattern><template><srai>parentsresponse</srai></template></category>
<category><pattern>PARENTS</pattern><template><srai>parentsresponse</srai></template></category>
<category><pattern>PARENTS</pattern><template><srai>parentsresponse</srai></template></category>
<category><pattern>PARENTSRESPONSE</pattern>
<template>
<random>
<li>Response 1</li>
<li>Response 2</li>
<li>Response 3</li>
</random>
<srai>promptuser</srai>
</template>
</category>
我希望同时具有多重响应和条件功能,例如,如果我传入“语音”条件,它会选择
<category><pattern>LEGACYRESPONSE</pattern>
<template>
<condition name = "inputtype">
<li value = "speech">Some Speech only response</li>
<li>Some speech or text response</li>
<li value = "text">Some text only response.</li>
</condition>
<srai>promptuser</srai>
</template>
</category>
任何帮助将不胜感激?
【问题讨论】:
-
抱歉,我仍然无法理解您的问题。您已经使用 Python 将“inputtype”设置为“Speech”,现在您想要来自 AIML 的 2 个响应?或者您想要语音响应或没有价值时?
标签: python artificial-intelligence chatbot aiml