4

I am beginning a project on Python that implements PyAIML and I wrote the following code to create a 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 an AIML set to begin development. So I did, but I'm stuck there.

Please help. I'm a noob programmer so don't be rough on me for this dumb mistake.

Thanks in advance!

Freelancer
  • 836
  • 1
  • 14
  • 47

2 Answers2

4

The .learn() method will not throw an error if the file you pass it does not exist, and I'm guessing that you are trying to learn patterns from "std-startup.xml" without having this file in your directory.

Make sure the file std-startup.xml is in the directory you are running your script from. 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 "Other Files/Standard AIML Set/" folder on the pyaiml source forge site. Go to that folder and download the one of the tarballs or the zip.

  • I have a directory with all the AIML files (I suppose is the one with the ".aiml" file extensions), but the std-startup.xml isn't present anywhere in the system. Any tips on that? – Sebastian Garrido Mar 12 '13 at 01:16
  • The file **std-startup.xml** should be in the same directory as your script. You can get it from the link in my post (it comes in the same tarball as the standard AIML set). Learning the patterns from this file and then calling `.respond("LOAD AIML B")` causes the patterns from the standard AIML set, which should be in a directory called **standard**, to be learned. – Matthew Mellott Mar 12 '13 at 01:18
  • Thank You! My ALICE set lacked the std file and as such presented this problem. Sorry for the inconvenience:( – Sebastian Garrido Mar 12 '13 at 01:32
  • No problem :) If you liked the post you can mark it as the answer. – Matthew Mellott Mar 24 '13 at 04:44
  • Just a note to say that https://sourceforge.net/projects/pyaiml/files/ is now a broken link. Looks like the correct tree is here: https://github.com/DYFeng/pyaiml/tree/master/standard now. – Hugh Barnard Mar 26 '16 at 17:58
3

A few things:

  1. If your AIML is loading properly, pyAIML will respond with a line that will read something like: Loading std-startup.aiml... done (1.00 seconds) It will not necessarily throw an error if it does not find a file to load, so if you don't see this line, pyAIML has not loaded the AIML file.

  2. I don't see 'std-startup.xml' in the sourceforge directory either, but this shouldn't matter. All that you're loading is any AIML file that will allow you to test the kernel. Try loading the 'self-test.aiml' file in the /aiml directory instead. (Double-check to make sure the file suffix in your code is .aiml and not .xml)

  3. k.respond() is for giving the bot some input and 'LOAD AIML B' is just a test phrase. Once you've loaded 'self-test.aiml' try k.respond('test date') and you should get

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

russellmania
  • 640
  • 2
  • 8
  • 21