Thursday, July 17, 2008
Saying a list of AIML responses in order
Question:
I use the <random> tag in AIML when I have a list of responses. But instead of saying the responses randomly, is there any way I can get the bot to say them in a specific order? For example, I have four responses for one input pattern. Can I get the bot to say them one by one each time that pattern is activated?
Answer:
There is no specific tag for that in AIML, but it is not too hard to implement using existing AIML tags. In this example, the input xxx results in "Response One" the first time it is entered, "Response Two" the second time, "Response Three" the third time, then "Response Four", then cycles back to "Response One."
The program uses the AIML variable "state" to keep track of which response is next. Some categories are provided to implement a "successor" function to advance the state variable through I, II, III, IV and back to I.
<aiml version="1.0">
<category>
<pattern>xxx</pattern>
<template>
<think>
<set name="state">
<srai>SUCCESSOR <get name="state"/></srai>
</set>
</think>
<srai>say response <get name="state"/></srai>
</template>
</category>
<category><pattern>SUCCESSOR</pattern>
<template>I</template>
</category>
<category><pattern>SUCCESSOR *</pattern>
<template>I</template>
</category>
<category><pattern>SUCCESSOR I</pattern>
<template>II</template>
</category>
<category><pattern>SUCCESSOR II</pattern>
<template>III</template>
</category>
<category><pattern>SUCCESSOR III</pattern>
<template>IV</template>
</category>
<category><pattern>SUCCESSOR IV</pattern>
<template>I</template>
</category>
<category>
<pattern>SAY RESPONSE I</pattern>
<template>Response One.</template>
</category>
<category>
<pattern>SAY RESPONSE II</pattern>
<template>Response Two.</template>
</category>
<category>
<pattern>SAY RESPONSE III</pattern>
<template>Response Three.</template>
</category>
<category>
<pattern>SAY RESPONSE IV</pattern>
<template>Response Four.</template>
</category>
<category>
<pattern>SAY RESPONSE *</pattern>
<template>Undefined.</template>
</category>
</aiml>
Tuesday, June 03, 2008
Loebner Prize 2008 Draws 13 Entries
- Zeta by Jeremy Gardiner
- Elbot by Fred Roberts
- Eugene Goostman by Vladimir Veselov
- Orion by Adeena Mignogna
- LQ by Qiong John Li
- Brother Jerome by Peter Cole & Benji Adams
- Chip Vivant by Mohan Embar
- Jabberwacky by Rollo Carpenter
- Alice by Richard Wallace
- Botooie by Elizabeth Perreau
- Amanda by Simon Edwards
- Ultra Hal by Robert Medeksza
- trane by Robert Scott Mitchell
Three of this years entries areprevious Loebner winners and two of them multi-year winners. Two of the entries this year use AIML: Orion by Adeena Mignogna and our own ALICE bot.
Saturday, May 31, 2008
Actionscript 3 Pandorabot Chat Class
Marcus announced these new features in his AS3 script:
One line implementation - You can get a basic Flash Chat Pandorabot going by filling in the "yourbotid" and "Common Bot Name" arguments in this one line of code:
var botChat:Chat = new Chat("yourbotid","Common Bot Name",stage.stageWidth/2,stage.stageHeight/1.3, 85, false);
Drag - The topbar is draggable like any other application window.
Close Button - Want users to stay on your site but able to turn the chatbot off? There's a handy close button for that.
Typing Speed - A simple variable (85 up above), that controls the typing speed of your robot. Want it to respond more slowly or quickly? Adjust that. Anyway, there are a lot more subtle things in the class as well, and I hope you enjoy it.
You can download the necessary files at http://www.diariesofwar.com/downloads/AS3Chat.zipFinally, Marcus says, "Help me get my own Superbot, make a paypal donation to waarangel@gmail.com"
Wednesday, May 28, 2008
Program E Bug Fix
I am working with a developer who knows PHP well but not too much AIML. I know AIML but not much PHP. He found something in the code that apparently fixes the bug, at least in the tests we have done. I don't know if anyone is officially maintaining Program E at the moment, but anyone working with the code may be able to check this solution.
By the way, we are using version 0.8 of Program E.
Here is what he said:
Dr. Wallace, this is piece of code which was changed by me. The only line I added is highlighted below.
This code is executed when no match is found by the “graphwalker”.
As graphwalker searches for matches it adds words matched by the “*” wildcard to $inputstarvals.
But when it reaches it the end of the input and finds no matches it should clear $inputstarvals reference and return back to the root of the tree.
// Else no match found...
if ((($whichresult[0]==-1)&&(
//If we were most recently on a wildcard (*,_) then we are still matching it.
if (($onwild==1)&&($word!="")&&(
debugger("On wild and in *. keep going with graphwalker.",2);
addtostar($parton,$word,
return graphwalker($remains,$parent,1,1,$parton,$inputstarvals,$thatstarvals,$topicstarvals,
}
else {
//We didn't find anything. We need to come back out
$inputstarvals=array();
debugger("Result is blank from query in *. Returning blank",2);
return "";
}
}
Attached is the latest (Program E 0.9) version of this script. We use version is 0.8. This code should work the same way in the latest version. Changes which were introduced between 0.8 and 0.9 are not related to this piece of code.
Program E Bug
Suppose you create a simple default category:
<category>
<pattern>*</pattern>
<template>Keywords: <star/></star>
</template>
Assuming there is no other AIML, this category will just echo
whatever you type:
Client: Hello there
Bot: Keywords: Hello there
Client: testing one two three
Bot: Keywords: testing one two three
Now add a second AIML category,
<category>
<pattern>_ TEST ME *</pattern>
<template><srai>TEST ME</srai></template>
</category>
We get the expected result:
Client: xxx test me xxx
Bot: Keywords: TEST ME
Ok, finally, add one more category:
<category>
<pattern>TEST * ME</pattern>
<template>
</category>
Now it is messed up:
Client: test xxx me
Bot: ME
What happened to the "TEST"?
and even the one that worked before is broken:
Client: xxx test me xxx
Bot: ME
If we copy the same AIML test file over to Pandorabots:
Client: test xxx me
Bot: TEST ME
Client: xxx test me xxx
Bot: TEST ME
Saturday, April 26, 2008
Vote for A.L.I.C.E.!
Unlike the famous Loebner Prize contest, the Chatterbox Challenge allows entries to be submitted online. So in many cases, you can chat directly with these bots over the web. (The organizers of the Loebner Prize are concerned about cheating.) Also unlike the conventional Turing Test, the Chatterbox Challenge does not directly compare human and bot performance; it is a ranking of the bots on their own merits.
If you do choose to vote for A.L.I.C.E., we appreciate your support!
Friday, April 25, 2008
How to compare two variables in AIML
Pandorabots implemented
Suppose the botmaster wants to compare two predicates with the values JOHN and PAUL.
The basic "trick" behind Steve's method is to "learn" a new category like
<category>
<pattern>BOTCHECK JOHN</pattern>
<template>
<think>
<set name="match">YES</set>
</think>
</category>
The comparison uses symbolic reduction to test <srai>BOTCHECK PAUL</srai>. This does not match the newly learned categroy with the pattern BOTCHECK JOHN. It does however match another category:
<category>
<pattern>BOTCHECK *</pattern>
<template>
<think><set name="match">NO</set> </think>
</category>
Only the input BOTCHECK JOHN will match the first category, in which case the predicates have the same value. The AIML Steve developed is a little more complicated than that, and you can find out all the details in his post to the mailing list.
You can download the free AIML variable comparison set from
http://www.square-bear.co.uk/aiml/botcompare.aiml
Friday, April 18, 2008
Pandorabots mentioned in New Scientist
After identifying Ron Ingram as the creator of Godsbot, the authors say "The trail from Godsbot doesn't stop there, either. Feedback has tracked down the source of the AI software, a site called Pandorabots, which lets you design your own software robots and turn them loose on the Internet. When we last checked, the site boasted that Pandorabots had served up 564,580,317 replies. Is it too late to shut the lid?"
German Alice is back online
