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()
It is throwing an error like
Traceback (most recent call last): File "init.py", line 3, in kernel = aiml.kernel() AttributeError: 'module' object has no attribute 'kernel'
aiml.kernel() should be aiml.Kernel()
Note the aiml package only works with Python 2. Py3kAiml on GitHub is a Python 3 alternative. You also refer to this post.