def start(): kernel = Kernel() kernel.verbose(False) if isfile(FILE_PATH+"aimlFiles\\brain.brn"): kernel.bootstrap(brainFile=FILE_PATH+"aimlFiles\\brain.brn") else: print("Please run brain.py file present in aimlFiles directory") exit() return kernel
""" This file contains the PyAIML stress test. It creates two bots, and connects them in a cyclic loop. A lot of output is generated; piping the results to a log file is highly recommended. """ # import aiml from aiml import Kernel # Use PyAiml dev # Create the kernels kern1 = Kernel() kern1.verbose(False) kern2 = Kernel() kern2.verbose(False) # Initialize the kernels print("Initializing Kernel #1") kern1.bootstrap(learnFiles="std-startup.xml", commands="load aiml b") kern1.saveBrain("standard.brn") print("\nInitializing Kernel #2") kern2.bootstrap(brainFile="standard.brn") # Start the bots off with some basic input. response = "askquestion" # Off they go! while True: response = kern1.respond(response).strip() print("1:", response) response = kern2.respond(response).strip() print("2:", response)