Data suggested this had a thread for itself so here it is.
I like AIML, I think it's quite elegant and useful. People like SquareBear have shown what it can do. So I thought I would have a crack at AIML again. I was wanting to host it somewhere, so needed an interpreter. I like PHP and there was Program O, but I decided it would be interesting to write my own.
One thing I wanted to change about AIML was that an input has to exactly match a pattern to get a hit. I felt I could improve on that. So I went all fuzzy. This thread will deal with my ideas and what I have achieved. I'm not sure how much I will get done now the weather is so lovely, but I am working on the interpreter and it's preprocessing quite a lot lately. I have a few AIML tags working, but have a fair bit to still do. Anyway I will update as I go.
I'm working on spelling mistakes at the moment and still have a few things to try.
Just a little taster to show you how this fuzzy preprocessing fleshes out. Take this AIML pattern...
<category>
<pattern>NAME THE ROMAN SOLDIER WHO IS SUPPOSED TO HAVE STABBED JESUS</pattern>
<template>Longinius</template>
</category>
Normally with AIML you would have to input the exact pattern to get a match - but I can get a hit with lines like this :
"Who was that man who stabbed Jesus ?"
Making it a bit more flexible. Keywords are the key here.
In a different way I can get hits with spelling mistakes :
<category>
<pattern>WHO WROTE CANDIDE</pattern>
<template>Voltaire</template>
</category>
Take note of the spelling of Candide. With my approach I get a hit with...
"Who wrote Candede ?"
Ask most AIML bots "What is a fish ?" and they will tell you...
"A cold-blooded vertebrate who lives in the ocean or fresh water."
Ask them "What is a fosh ?" and they will fall back to a default no-answer-for-that reply.
And similar things. One of the things I am doing I mentioned a while back here and that's using
Levenshtein Distance.
Together with keywords and some other nifty ways of comparing strings it works quite well and makes my AIML bot a bit more flexible.
At the time of writing this I am still in the early stages. It's going to take me a while to see how effective it is. Sometimes I can see that a pattern match might not be desirable but as I have introduced a scoring mechanism maybe I can control that. The spelling mistakes I think will work well. It all remains to be seen.