Posted: Tue Aug 22, 2006 5:23 pm Post subject: Converting AIML to RiveScript
A question was just raised about whether or not my Aiml2Alpha code was still around. It's not. I took what I used to have of it and converted it to an Aiml2RiveScript code.
I gave up on parsing AIML a long time ago, but now I have two different versions of my Aiml2RiveScript code. In one version, there was just a plain text converter (which didn't use XML::Parser and just parsed the file as if it were a string), which is what Aiml2Alpha did. The other version seems to have this code but in addition has one that actually did use XML::Parser.
Anyhow, I'll attach the latest version of the Aiml2RiveScript converter code.
==================================
Using the Converter
==================================
1. Run mkdir.pl to create the necessary directories.
2. Download the Standard AIML set from AliceBot.org:
http://www.virtualitas.net/perl/aiml/standard-aiml-current.zip
3. Extract the AIML documents into the "aiml" folder created
by mkdir.pl
4. Run aiml2perl.pl to convert AIML documents into Perl code.
5. Run perl2rivescript.pl to convert the Perl code into RiveScript.
Notes:
- Any AIML set should work for this converter, not just the Standard
AIML. However, this has only been tested on Standard AIML and may not
work well with this converter.
- The converter tool is not perfect. There are some cases of invalid
RiveScript code being generated. For instance, std-atomic.aiml converts
over with one of the +Triggers being entirely empty.
- You should revise the generated RiveScript code for any such errors.
Parses the AIML files from "./aiml" using plain text
parsing. Only works on AIML files formatted in the way
of the Standard ALICE AIML set by Dr. Rich Wallace.
AIML files written with a different XML style cannot
be parsed.
This was the first version of an AIML to RiveScript
converter. It is very buggy.
Uses XML::Parser to load in all the AIML files from
"./aiml", and then uses Data::Dumper to dump the contents
of each file structure into text documents in the "perl"
folder.
This script doesn't parse beyond the <pattern>/<template>
tree. Other in-template tags aren't parsed.
AFTER RUNNING AIML2PERL.PL, this script will load all the
Perl data structures from the "perl" folder and write them
into the "rivescript" folder as (mostly) valid RiveScript
documents.