【发布时间】:2015-05-26 10:02:00
【问题描述】:
我正在尝试借助 AIML 文件构建一个基本的机器人。我可以在哪里提出问题,并且将为该模式返回匹配的模式。示例模式在我的 AIML 文件中。
<category>
<pattern>TEST</pattern>
<template>
Hi..This is the testing pattern. How are u doing
</template>
</category>
我正在使用 PyAIML 包将 python 与 AIML 集成。所以,如果我问“测试”,我得到的回应是 “嗨..这是测试模式。你好吗”。
query --->test
Answer --> Hi..This is the testing pattern. How are u doing
但如果我将上述模式更改为
<category>
<pattern>TEST</pattern>
<template>
<html>
<b>Hi..This is the testing pattern. </b> How are u doing
</html>
</template>
</category>
基本上如果我添加 html 标签。然后我的机器人没有响应。它为“测试”给出了空白答案。这里有什么问题?这是我在 python 中的代码
import aiml, sys
class Chat:
def main(self, query):
mybot = aiml.Kernel()
mybot.verbose(False)
mybot.learn('test.aiml')
chatReply = mybot.respond(query)
return chatReply
if __name__ == '__main__':
print Chat().main(sys.argv[1])
另外如果html标签因为我在python解释器中运行代码而不起作用,那么如何测试它是否会起作用。
【问题讨论】:
标签: python html artificial-intelligence aiml