<that> 和<topic>标记导致不匹配



我正在尝试学习AIML,我用以下3个文件构建了一个简单的聊天机器人:

std-startup.xml

<aiml version="1.0.1" encoding="UTF-8">
<category>
<pattern>
LOAD AIML B
</pattern>
<template>
<learn>key.aiml</learn>
</template> 
</category>
</aiml>

key.aiml

<aiml version="2.0" encoding="UTF-8">
<category>
<pattern>
CAN NOT UNLOCK
</pattern>
<template>
What are you trying to unlock? 
</template>
</category>
<category>
<pattern>* DOOR</pattern>
<that>What are you trying to unlock?</that>
<template>
<think><set name="door"><star/></set></think>
<condition name="door" value="apartment">
<think><set name="topic"><star/></set></think>
Is there any video on the screen? 
</condition>
<condition name="door" value="entrance">
<think><set name="topic"><star/></set></think>
Is there a green light? 
</condition>    
</template>
</category>
<topic name="apartment">
<category>
<pattern>yes</pattern>
<template>
topic set to apartment  
</template>
</category>
</topic>
<topic name="entrance">
<category>
<pattern>yes</pattern>
<template>
topic set to entrance  
</template>
</category>
</topic>
</aiml>

simply.py

import aiml
kernel = aiml.Kernel()
kernel.learn("std-startup.xml")
kernel.respond("load aiml b")
while True: 
input_text = input(">Tenant: ")
response = kernel.respond(input_text)
print(">Bot: ", response)

但是,上面的方法不起作用,并且没有返回匹配的"* DOOR"one_answers";yes"除非我注释和标签。我按照教程做了一个T,但我不明白为什么它说WARNING: No match found for input: yes

请帮助我理解我的错误。

你不应该在<标签。省略问号就可以了。>

相关内容

  • 没有找到相关文章

最新更新