[pandorabots-general] How to match in topic
Chris Fellows
chrisc_fellows at yahoo.com
Sat Feb 3 10:41:57 PST 2007
Hi - Thanks for your quick response.
(I didn't see in my mail, so apologies to list members for the cross posting to the alice-style and alice general lists.)
Yes, that's definitely interesting to me.
I come from a Java and object oriented programming background. What you've replied with, in OOP terms, is called polymorphism - if we're considering topics to be seperate classes. So that's great, based on user input it'll choose the correct response.
Now if the user doesn't enter money, cars or madonna, it won't get a match. So I guess we'd have to code to that and have a generic MANY THINGS response.
It looks like its possible to have a topic inside of a topic which could support a form of polymorphism or class inheritance.
Just tried out the following code and it works which is great.
<topic name="foo">
<topic name="bar">
<category>
<pattern>MANY THINGS</pattern>
<template>BAR</template>
</category>
</topic>
<category>
<pattern>MANY THINGS</pattern>
<template>FOO</template>
</category>
</topic>
I'm impressed by how easy it is to pick up and use AIML. My only concern so far is that it seems to encourage a great deal of code duplication. I wish there was a way to reuse existing code, for example, doing look ups to other topics or something of that nature. But then again, this could just be my inexperience with AIML so far.
Chris
----- Original Message ----
From: GT40 <gt40 at tiscali.fr>
To: pandorabots-general at list.pandorabots.com
Sent: Friday, February 2, 2007 10:24:52 AM
Subject: Re: [pandorabots-general] How to match in topic
Hi Chris!
I'm also a newbie in AIML, but I'm not sure we're allowed to use the if/then
instruction inside template tags (or maybe in an embedded script?).
I tried the following lines on a bot of mine and it seems to work.
<category>
<pattern>I WOULD LIKE TO KNOW ABOUT *</pattern>
<template>
Sure, what would like to know about <star />?
<think><set name="topic"><star /></set></think>
</template>
</category>
<topic name="MONEY">
<category>
<pattern>MANY THINGS</pattern>
<template>Are you rich?</template>
</category>
</topic>
<topic name="CARS">
<category>
<pattern>MANY THINGS</pattern>
<template>Do you know the Ford GT40?</template>
</category>
</topic>
<topic name="MADONNA">
<category>
<pattern>MANY THINGS</pattern>
<template>Do you like "Hollywood"?</template>
</category>
</topic>
Maybe you could improve this.
--
View this message in context: http://www.nabble.com/How-to-match-in-topic-tf3157243.html#a8768917
Sent from the Pandorabots-general mailing list archive at Nabble.com.
_______________________________________________
This is the pandorabots-general mailing list
To Post, reply to pandorabots-general at list.pandorabots.com
Unsubscribe and change preferences at http://list.pandorabots.com/mailman/listinfo/pandorabots-general
Learn netiquette at http://www.dtcc.edu/cs/rfc1855.html
Learn to read at http://www.literacy.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://list.pandorabots.com/pipermail/pandorabots-general/attachments/20070203/88c67a09/attachment.html
More information about the pandorabots-general
mailing list