import aiml
import os
kernel = aiml.kernel()
if os.path.isfile("bot_brain.brn"):
kernel.bootstrap(brainFile = "bot_brain.brn")
else:
kernel.bootstrap(learnFiles = "std-startup.xml", commands = "load aiml b")
kernel.savebrain("bot_brain.brn")
while True:
print kernel.respond(raw_input("Enter Your Message")).strip()
aiml.kernel()
正在抛出类似
的错误追踪(最近一次通话): 文件“ init .py”,第3行,in kernel = aiml.kernel() AttributeError:'module'对象没有属性'kernel'
答案 0 :(得分:0)
aiml.kernel()应该是aiml.Kernel()
注意,aiml包仅适用于Python 2.GitHub上的Py3kAiml是Python 3的替代品。您还可以参考此post。
答案 1 :(得分:0)
运行pip install python-aiml
不是 pip install aiml