我正在尝试使用AIML创建一个机器人,并且在下面的代码中,只有最后一项被识别为YES答案。为什么会这样?
data:,
<category>
<pattern> * </pattern>
<template><random>
<li>Hi i am aviator wanna talk about boeing airplanes</li>
<li>Hello how are you what about discuss boeing airplanes</li>
<li>Well hello wanna talk about boeing airplanes</li>
<li>Hi there what abou talk of some boeing airplanes</li>
<li>Hey there could we talk about boeing airplanes</li>
<li>What about talk of airplanes</li>
</random></template>
提前致谢。
答案 0 :(得分:0)
这是因为只有一个&#39;在模式中,而不是列表。
然而,你可以做的是设置一个主题&#39;然后它会像你期望的那样工作。作为回应,请在任务完成时重置主题。
<category>
<pattern> * </pattern>
<template>
<think><set name = "topic">planes</set></think>
<random>
<li>Hi i am aviator wanna talk about boeing airplanes</li>
<li>Hello how are you what about discuss boeing airplanes</li>
<li>Well hello wanna talk about boeing airplanes</li>
<li>Hi there what abou talk of some boeing airplanes</li>
<li>Hey there could we talk about boeing airplanes</li>
<li>What about talk of airplanes</li>
</random></template>
</category>
<topic name="planes">
<category>
<pattern>YES</pattern>
<template><think><set name = "topic"></set></think>OK then, <set name = "topic">747</set> it will be!</template>
</category>
</topic>
答案 1 :(得分:0)
另一种方法是在<that>
模式中使用通配符。然后,您的第二个类别将变为:
<category>
<pattern>YES</pattern>
<that>* AIRPLANES</that>
<template>OK then, <set name = "topic">747</set> it will be!</template>
</category>
当AI的最后响应是以AIRPLANES结尾的任何文本时,<that>
开头的*与YES的输入匹配。另请注意,使用大写字母指定<pattern>
文本和<that>
文本的可选AIML约定。