Hi, I may have found a slightly simpler solution using <that> and
<topic> that doesn't need <condition> tags.
One limitation is that we don't bother to save the actual topic. We
assume the rest of the AIML does not use the <topic> tag.
Check this out:
<!-- here is the default pattern category -->
<category>
<pattern>*</pattern>
<template>
<srai>RANDOM PICKUP LINE</srai>
<think><set name="topic">one pickup</set></think>
</template>
</category>
<!-- There are three random pickup lines: Pickup One. Pickup Two and
Pickup Three -->
<category>
<pattern>RANDOM PICKUP LINE</pattern>
<template>
<random>
<li>Pickup one.</li>
<li>Pickup two.</li>
<li>Pickup three.</li>
</random>
</template>
</category>
<!-- Here is the default line we want to say after 3 consecutive
pickup lines -->
<category>
<pattern>DEFAULT PICKUP LINE</pattern>
<template>
I'm sorry we couldn't answer your question. Please call customer
service at 1-xxx-xxxx.
</template>
</category>
<!-- The following 3 categories use <that> to match the 3 different
pickup lines. -->
<!-- In this state the bot has said one pickup line as its last utterance. -->
<!-- The bot sets the topic state to "two pickups". -->
<category>
<pattern>*</pattern><that>pickup one</that>
<template>two pickups. <srai>RANDOM PICKUP LINE</srai>
<think><set name="topic">two pickups</set></think>
</template>
</category>
<category>
<pattern>*</pattern><that>pickup two</that>
<template>two pickups. <srai>RANDOM PICKUP LINE</srai>
<think><set name="topic">two pickups</set></think>
</template>
</category>
<category>
<pattern>*</pattern><that>pickup three</that>
<template>two pickups. <srai>RANDOM PICKUP LINE</srai>
<think><set name="topic">two pickups</set></think>
</template>
</category>
<!-- The following 3 categories match when the bot is in the state
"two pickups". -->
<!-- The bot says one of the random pickup lines and sets the state to
"three pickups". -->
<topic name="two pickups">
<category>
<pattern>*</pattern><that>pickup one</that>
<template>three pickups. <srai>RANDOM PICKUP LINE</srai>
<think><set name="topic">three pickups</set></think>
</template>
</category>
<category>
<pattern>*</pattern><that>pickup two</that>
<template>three pickups. <srai>RANDOM PICKUP LINE</srai>
<think><set name="topic">three pickups</set></think>
</template>
</category>
<category>
<pattern>*</pattern><that>pickup three</that>
<template>three pickups. <srai>RANDOM PICKUP LINE</srai>
<think><set name="topic">three pickups</set></think>
</template>
</category>
</topic>
<!-- These 3 categories match in the state "three pickups" -->
<!-- Now the bot has uttered three consecutive pickup lines, so we
select the default line. -->
<topic name="three pickups">
<category>
<pattern>*</pattern><that>pickup one</that>
<template><srai>DEFAULT PICKUP LINE</srai>
</template>
</category>
<category>
<pattern>*</pattern><that>pickup two</that>
<template><srai>DEFAULT PICKUP LINE</srai>
</template>
</category>
<category>
<pattern>*</pattern><that>pickup three</that>
<template><srai>DEFAULT PICKUP LINE</srai>
</template>
</category>
</topic>
<!-- One extra conversational category to test nonconsecutive pickups: -->
<category>
<pattern>HELLO</pattern>
<template>Hi there!</template>
</category>
</aiml>
On Wed, May 21, 2008 at 8:49 PM, Mike Procter <
mikeprocter@...> wrote:
>
> Well, here is an attempt to simplify the relevant aiml. Not all
> supporting categories are present but hopefully it demonstrates the
> concept adequately.
>
> Some background. This was developed as part of an on going study, by Bob
> Heller at Athabasca University, into the application of historical
> figure conversational agents in distance education. A few famous names
> from the field of Psychology are represented by Freudbot, Piagetbot, and
> Skinnerbot.
>
> Part of the challenge in using a conversational agent for education is
> keeping the conversation "on topic" (referring to the subject, not an
> aiml topic). One of the methods for addressing this is to identify when
> multiple consecutive non-matches occur. Basically, the pre-processor
> approach allows us to apply conditional(s) to every user input.
>
> The extra aiml processing associated with this is significant but does
> not seem to cause a problem in response times as a rule.
>
> If you'd like to try it out, visit Freudbot's office in SecondLife:
>
http://slurl.com/secondlife/Athabasca%20University/178/153/249>
> Mike
>
>
> <category>
> <pattern>CONNECT</pattern>
> <template>
> <think>
> Saving actual topic: <set name="theactualtopic"><get
> name="topic"/></set>;
> Setting topic to: <set name="topic">PREPROCESSOR</set>;
> </think>
> </template>
> </category>
>
> <topic name="PREPROCESSOR">
>
> <!-- Saves input pattern in ppstar, restores topic from theactualtopic
> -->
> <!-- SRAI's PREPROCESSOR -->
> <category>
> <pattern>_</pattern>
> <template>
> <think>
> Processing: <set name="ppstar"><star/></set>;<br/>
> <condition name="theactualtopic" value="PREPROCESSOR">
> <set name="theactualtopic"><get name="startingtopic"></set>
> </condition>
> Restoring actual topic: <set name="topic"><get
> name="theactualtopic"/></set>;<br/>
> </think>
> <srai>PREPROCESSOR</srai>
> </template>
> </category>
>
> </topic>
> <!-- End PREPROCESSOR -->
>
> <!-- Increments inputcount (INCR * routine not shown) -->
> <!-- SRAI's user input from ppstar -->
> <!-- After processing user input... -->
> <!-- if otflag (ot = off topic) is 1 indicates * was matched so
> increments otcount -->
> <!-- if otflag is 0, resets otcount -->
> <!-- resets otflag to 0 -->
> <!-- saves current topic to theactualtopic and sets topic to
> PREPROCESSOR -->
> <category>
> <pattern>PREPROCESSOR</pattern>
> <template>
> <think>
> inputcount was: <set name="counter"><get name="inputcount"/></set>;
> setting inputcount: <set name="inputcount"><srai>INCR PP2</srai></set>;
> </think>
> <srai><get name="ppstar"/></srai>
> <think>
> <condition name="otflag">
> <li value="1">
> otcount was: <set name="counter"><get name="otcount"/></set>;
> setting otcount: <set name="otcount"><srai>INCR PP1</srai></set>;
> </li>
> <li>Setting otcount: <set name="otcount">0</set></li>;
> </condition>
> Setting otflag: <set name="otflag">0</set>;
> <br/><br/>Done executing...<br/>
> <condition name="topic">
> <li value="PREPROCESSOR"></li>
> <li>
> Saving actual topic: <set name="theactualtopic"><get
> name="topic"/></set>;<br/>
> Setting topic to: <set name="topic">PREPROCESSOR</set>;<br/>
> </li>
> </condition>
> </think>
> </template>
> </category>
>
> <!-- Sets otflag (off topic flag) -->
> <!-- Checks otcount (how many consecutive hits on *), -->
> <!-- if 3 then suggests new topic (SUGGESTTOPIC not shown) -->
> <!-- else tries typical default categories (not shown) -->
> <category>
> <pattern>*</pattern>
> <template>
> <think>
> <set name="otflag">1</set>
> </think>
> <condition name="otcount">
> <li value="3"><think><set
> name="otcount">0</set></think><srai>SUGGESTTOPIC</srai></li>
> <li>
> <random>
> <li><srai>SAY CONFUSION STATEMENT</srai></li>
> <li><srai>ASKRANDOMQUESTION</srai></li>
> <li><srai>SAYDEADENDSTATEMENT</srai></li>
> </random>
> </li>
> </condition>
> </template>
> </category>
>
>
>
> -----Original Message-----
> From:
alicebot-general-bounces@...
> [mailto:
alicebot-general-bounces@...] On Behalf Of Dr.
> Rich Wallace
> Sent: May 21, 2008 3:59 PM
> To: Alicebot and AIML General Discussion
> Subject: Re: [alicebot-general] Pickup Line Puzzle
>
>
> Yes, I'd like to see it. Is it too long to publish here?
>
>
> _______________________________________________
> This is the alicebot-general mailing list
> Reply to
alicebot-general@...
> Unsubscribe and change preferences at
http://list.alicebot.org/mailman/listinfo/alicebot-general> Learn netiquette at
http://www.dtcc.edu/cs/rfc1855.html> Learn to read at
http://www.literacy.org/>
_______________________________________________
This is the alicebot-general mailing list
Reply to
alicebot-general@...
Unsubscribe and change preferences at
http://list.alicebot.org/mailman/listinfo/alicebot-generalLearn netiquette at
http://www.dtcc.edu/cs/rfc1855.htmlLearn to read at
http://www.literacy.org/