Time: 1248822852 Author: kirsle Subject: AIML 2 RiveScript Converter Avatar: RiveScript-Hazard.png Categories: AIML Privacy: public IP: 72.37.252.50 NoEmote: 1 NoReply: 0 This script is still in beta, but it's so far been my best attempt at writing a script to convert AIML code to RiveScript.

It does this by turning all of the AIML code below <pattern>, <template>, and <that> into CDATA blocks, so that XML::Simple can load it and the real contents of these tags will come in as raw XML code. Then this is fed to a gang of Perl regular expressions.

It's a bit buggy and sometimes it doesn't convert certain bits of AIML correctly (most notably when tags are stacked on top of each other really heavily, e.g. a "set" that "formal"izes the "star"), but I also included a really simple syntax checking script that will look for these edge cases after the fact. Compared with the behemoth that is ALICE, the relatively few cases that don't quite make it are manageable and can be fixed up by hand.

I have all of this in a subversion repository, including Richard Wallace's ALICE set of AIML, a set of RiveScript docs that I got after running the app, and the aiml2rs app itself.

Due to a bug in RiveScript 1.19, you can expect to be stuck in the occasional deep recursion loop. This has been fixed in the RiveScript 1.20 version, which you can get from SVN right now. It isn't on CPAN yet and won't be until I get everything I want done to it.

Get the latest RiveScript that fixes the deep recursion error

svn checkout http://svn.kirsle.net/repos/RiveScript-perl/trunk RiveScript-perl
Or download RiveScript.pm over HTTP: http://svn.kirsle.net/repos/RiveScript-perl/trunk/lib/RiveScript.pm

Get the aiml2rs code

svn checkout http://svn.kirsle.net/repos/aiml2rs/trunk aiml2rs
Or get it over HTTP: http://svn.kirsle.net/repos/aiml2rs/trunk.

I don't feel motivated enough at the moment to fix the syntax errors in Richard Wallace's ALICE. It'll just require me to sit down and do it one of these days. When that happens I'll zip up the ALICE brain for RiveScript and post a download link to it on this site somewhere.

This script was created with ALICE in mind and a lot of the edge cases I programmed in are there to deal with quirks in ALICE's code. I make no guarantees it will work very well with Amy or any other AIML brains you may have at your disposal. And as always, RTFM, and YMMV.