问题描述
我正在尝试学习 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>
简单的.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”和“是”的匹配项。我按照教程做了一个 T 但我不明白为什么它说 WARNING: No match found for input: yes
请帮助我理解我的错误。
解决方法
您不应在