Thursday, July 17, 2008

Saying a list of AIML responses in order

Here is a good question that came in about AIML style:

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

The following thirteen entries are entered into the preliminary phase of the 2008 Loebner Prize for Artificial Intelligence:
  1. Zeta by Jeremy Gardiner
  2. Elbot by Fred Roberts
  3. Eugene Goostman by Vladimir Veselov
  4. Orion by Adeena Mignogna
  5. LQ by Qiong John Li
  6. Brother Jerome by Peter Cole & Benji Adams
  7. Chip Vivant by Mohan Embar
  8. Jabberwacky by Rollo Carpenter
  9. Alice by Richard Wallace
  10. Botooie by Elizabeth Perreau
  11. Amanda by Simon Edwards
  12. Ultra Hal by Robert Medeksza
  13. 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

Pandorabots has an XML-RPC interface that allows botmasters to link the A.I. chat bot to third party applications such as SMS, Second Life and Flash. Flash James Durrant, released a free script to integrate Pandorabots with Flash Actionscript 2. Now with Actionscript 3 becoming so widely adopted, another programmer, Marcus Dickinson, has updated Jamie's old Flash Chat interface into something more current.

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.zip

Finally, Marcus says, "Help me get my own Superbot, make a paypal donation to waarangel@gmail.com"

Wednesday, May 28, 2008

Program E Bug Fix

This is the fix we found for the bug we reported in Program E.

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)&&($whichresult[1]==-1)&&($whichresult[2]==-1))||($continuenode==1)) {

//If we were most recently on a wildcard (*,_) then we are still matching it.

if (($onwild==1)&&($word!="")&&($word!="")&&($word!="")){

debugger("On wild and in *. keep going with graphwalker.",2);

addtostar($parton,$word,$inputstarvals,$thatstarvals,$topicstarvals,2);

return graphwalker($remains,$parent,1,1,$parton,$inputstarvals,$thatstarvals,$topicstarvals,$patternmatched);

}

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

We found a bug in the Program E AIML interpreter and discovered a possible workaround. This post describes the bug; we will publish the solution in a subsequent post.

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>TEST ME</srai></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.!

The 2008 Chatterbox Challenge judges have selected A.L.I.C.E. as the #1 chatter bot in preliminary scoring! Now it is your turn to vote for the best of the bots. The judges have selected the top 20 bots, and the Chatterbox Challenge is open to public voting. Whether you vote for A.L.I.C.E. or not, you will be amazed by the variety and quality of bots competing in this year's contest.
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

Steve Worswick (Square-Bear) has done something amazing. In AIML, there is no obvious way to compare to variables (or predicates, as they are called in AIML). But with a clever use of the Pandorabots AIML extensions and , Steve has come up with a way to compare to variables.

Pandorabots implemented and in order to help botmasters write scripts for their bots to learn new AIML categories from conversations. Steve has discovered that these extensions can also be used to create a dynamic extension to the language, that allows the botmaster to compare two variables.

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

The New Scientist Feedback column ran a story about Ron Ingram's Godsbot in the March 22 issue. The article describes the author's interactions with Godsbot, and concludes that it must be based on ELIZA. (Godsbot is, in fact, based on ALICE). The article cites the usual types of good, not-so-good, and humorous bot responses. Despite the obvious limitations, the author is "impressed".

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


Christian Drossmann, creator of the German ALICE bot, has written to say that the German speaking chatbot is back online and hosted at Pandorabots. Christan said he "couldn't resist giving the (Pandorabots) system a try", and he plans to analyze the log files and add more content to the "rather crude" standard categories in German. He said, "I missed the coding."


The bot is accessible via http://www.drossmann.de/


Furthermore, Christian informs us that a German guy developed a Skype-plugin for Program E E, the AIML interpreter in PHP. You can find it at http://blog.kevinkempfer.de/2008/02/12/alice4skype-ist-da/.

The page is in German, but the download links are almost at the top of the page where you will find the hyperlinked words "Windows" and "Linux


For more information about German ALICE, you can contact Christian Drossmann via christian [at] drossmann [dot] de.
 

blogger templates | Make Money Online