<that> 和 <topic> 标签导致不匹配
<that> and <topic> tags cause no matches
我正在尝试学习 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)
但是,上面的方法不起作用,returns 没有匹配“* DOOR”和“yes”,除非我注释 和标签。我按照教程进行了 T,但我不明白为什么它说 WARNING: No match found for input: yes
请帮助我理解我的错误。
您不应在 标记内包含标点符号。漏掉问号,应该没问题。
我正在尝试学习 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)
但是,上面的方法不起作用,returns 没有匹配“* DOOR”和“yes”,除非我注释 和标签。我按照教程进行了 T,但我不明白为什么它说 WARNING: No match found for input: yes
请帮助我理解我的错误。
您不应在