[pandorabots-general] conditional based on a predicate
Dr. Rich Wallace
drwallace at alicebot.org
Mon Aug 14 13:22:38 PDT 2006
> Ron, if you take a look in the AIML AAA set,
> http://www.alicebot.org/aiml/aaa
>
> there is an example that begins in the Pickup.aiml file:
>
>
> <category> <pattern>*</pattern>
> <template> <srai>RANDOM PICKUP LINE</srai>
> <think>
> <set name="it"> <set name="topic"> <person/> </set> </set>
> <srai>PUSH <get name="topic"/></srai>
> </think>
> </template>
> </category>
> <category> <pattern>RANDOM PICKUP LINE</pattern>
> <template>
> <random>
> <li><srai>HAS INQUIRY <get name="has"/></srai></li>
> <li><srai>DOES INQUIRY <get name="does"/></srai></li>
> <li><srai>GENDER INQUIRY <get name="gender"/></srai></li>
> <li><srai>COLOR INQUIRY <get name="favcolor"/></srai></li>
> <li><srai>MOVIE INQUIRY <get name="favmovie"/>?</srai></li>
> <li><srai>LOCATION INQUIRY <get name="location"/></srai></li>
> ...
>
> The first few random pickup lines listed inside the <random> tag here
> are designed to match categories with special patterns in the
> Inquries.aiml file. The basic idea behind GENDER INQUIRY * for example,
> is to test whether the value of the predicate "gender" has been bound, and
> if not, inquire about the client's gender. Once the client's gender is
> known, we want the bot to stop asking that question.
>
> <category><pattern>GENDER INQUIRY OM</pattern><template>Are you a man or a
> woman?</template></category>
> <category><pattern>GENDER INQUIRY *</pattern><template>Do you like being a
> <star/>?</template></category>
>
> The AIML code here assumes that the default value of "gender" is OM.
>.
I should have added,
The Inquiry.aiml file also contains a little more helper AIML using <that>
patterns to set the value of "gender" after the bot makes the original
inquiry. These categories assume that the client replies with one of the
two most common obvious responses MAN or WOMAN:
<category><pattern>MAN</pattern>
<that>ARE YOU A MAN OR A WOMAN</that>
<template>
<think><set name="gender">man</set>
</think>
Thanks for telling me your gender, guy.
</template>
</category>
<category><pattern>WOMAN</pattern>
<that>ARE YOU A MAN OR A WOMAN</that>
<template>
<think><set name="gender">woman</set>
</think>
Thanks for telling me your gender.
</template>
</category>
More information about the pandorabots-general
mailing list