aiml - AIML - 上下文 - 为什么上下文不是在所有情况下都具有最高优先级?
问题描述
当使用 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
你能解释一下这两种意想不到的对话流程吗?
解决方案
该<that>
元素优先于同一模式级别的其他模式。我不知道您使用的是 AIML v1 还是 v2,但总的来说有 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 类别的最快方法就是问“NO”,然后看看机器人会回答什么。您也可以搜索 ALICE 文件,但这会非常耗时。
[注意]在 AIML v2 中至少有两个额外的级别:0 级高于下划线通配符,2.5 级使用模式侧集。然而,更简单的 AIML v1 级别可以解释您的异常情况。
推荐阅读
- angular - Angular 6 / Clarity UI - 表单页面验证,上传数据
- pyspark - pyspark中的窗口函数 - 奇怪的行为
- javascript - 访问 react-components 中的文档
- java - Android Volley 无法获取数据作为响应
- c# - 如何识别特定图像中的“绿色”?
- python - 出现错误:TypeError:'float' 类型的对象在 pandas 中没有 len()
- rest - Wire Mock:HTTP 方法 PATCH 不支持输出
- python - Pepper Linux 日志日期格式看起来毫无意义
- tfs - 如何自定义 TFS 构建任务
- ruby-on-rails - 创建现有 Rails 项目的可安装 PWA(Web 应用程序)