AIML-上下文-为什么上下文在所有情况下都不具有最高优先级?

tm1701

当使用AIML上下文时(通过<that>),我得到了一些我无法解释的对话。我希望上下文能够优先于其他任何事物。

下面我首先显示脚本。然后,我展示了一些对话。我在响应后面用//标记了意外的部分。

我将此Aiml文件添加到标准的ALICE对话中。

剧本:

<category><pattern>STEP 1</pattern>
  <template>Step 2</template>
</category>
<category><pattern>YES</pattern><that>STEP 2</that>
  <template>step 3</template>
</category>
<category><pattern>NO</pattern><that>STEP 2</that>
  <template>step 3</template>
</category>
<category><pattern>*</pattern><that>STEP 2</that>
  <template>step 3</template>
</category>
<category><pattern>*</pattern><that>STEP 3</that>
  <template>Step 4! and you typed '<star/>'</template>
</category>

在下面的对话中,我用//标记了意外的响应。

Human : step 1
Robot : Step 2
Human : yes
Robot : step 3
Human : yes
Robot : Step 4! and you typed 'yes'
Human : step 1
Robot : Step 2
Human : no
Robot : step 3
Human : no
Robot : So. // ? I expected here step 4
Human : step 1
Robot : Step 2
Human : any
Robot : any is a name. // ? I expected here step 3

您能否解释两种意外的对话流程?

Ubercoder

在相同模式级别,<that>元素优先于其他模式我不知道您使用的是AIML v1还是v2,但是从广义上讲,共有3个级别的模式[但请参见下面的注释]

  1. 最重要的级别=模式包括下划线通配符(_)
  2. 中级=没有任何通配符的原子模式
  3. 最低级别=模式,包括星号通配符(*)

您意外的响应是因为存在更高优先级的ALICE响应。例如,当机器人回答“第3步”,而人类说“否”时,您希望<pattern>*</pattern><that>STEP 3</that>类别生效。但是,如果有更高级别的ALICE响应(例如<pattern>NO</pattern><pattern>STEP _</pattern>),则该ALICE响应将在您的3级类别上生效<pattern>*</pattern><that>STEP 3</that>查找“驴友”类别的最快方法是询问“否”,然后查看机器人的答复。您也可以搜索ALICE文件,但这将非常耗时。

[note]在AIML v2中,至少有两个额外级别:下划线通配符上方的级别0,以及使用模式边集的级别2.5。但是,AIML v1的简单级别可以解释您的异常情况。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章