PyAIML does not load download

I am starting a Python project that implements PyAIML , and I wrote the following code to create the brain for my project:

import aiml k=aiml.Kernel() k.learn("std-startup.xml") k.respond("LOAD AIML B") k.saveBrain("jarvis.brn") 

When I run the program, I get this error: WARNING: No match found for input: LOAD AIML B

I understand that I needed to download the AIML suite to start development. So I did, but I was stuck there.

Please, help. I am a noob programmer, so don't be rude to me for this dumb mistake.

Thanks in advance!

+4
source share
2 answers

The .learn() method will not .learn() error if the file you are transferring does not exist, and I assume that you are trying to examine the templates from "std-startup.xml" without having this file in your directory.

Make sure the std-startup.xml file is in the directory in which you are using the script. You should also have a directory called standard in your working directory that contains the standard set of aiml files. Basically your directory should look like this:

  mydir/my_script.py mydir/std-startup.xml mydir/standard/a-bunch-of-std-aiml-files.aiml 

These files can be found in the folder "Other files / Standard AIML Set /" on the PR site to create the file . Go to this folder and download one of the tarballs or zip.

+4
source

A few things:

  • If your AIML loads correctly, pyAIML will respond with a line that will read something like: Loading std-startup.aiml... done (1.00 seconds) This will not necessarily result in an error if it does not find the file to load, so if you do not see this line, pyAIML did not load the AIML file.

  • I do not see 'std-startup.xml' in the sourceforge directory, but that doesn't matter. All you download is any AIML file that allows you to test the kernel. Try loading the self-test.aiml file in the / aiml directory. (Double check that the file suffix in your code is .aiml, not .xml)

  • k.respond() intended to provide some input to the bot, and LOAD AIML B is just a test phrase. Once you have downloaded "self-test.aiml", try k.respond ("test date") and you should get

The date is Wed Mar 13 01:37:07 2013 in response.

+2
source

All Articles