[alicebot-archcomm] Predefine predicates/properties

Jonathan Roewen alicebot-archcomm@list.alicebot.org
Wed, 30 Jul 2003 18:48:56 +1200


This is especially useful for Ernest ;-)

I was just writing a couple test examples for the new J-Alice code, and it
occured to me that there are other things that make your proposal less
desirable, and I'll also show how having content inside <get> will prove
it's usefulness.

For some predicates, you don't always want to have the same default value
depending on it's use. Currently, the only way to resolve this is to use the
<condition> tag, which just adds a lot more work to writing templates.

Here is some of my testcase AIML:

<category>
<pattern>WHO AM I</pattern>
<template>
You are <get name="name">unknown to me</get>.
</template>
</category>

<category>
<pattern>HELLO J-ALICE</pattern>
<template>
Hi there <get name="name">user</get>.
</template>
</category>

With your proposal, you'd need to provide a default value of the predicate
somewhere (maybe globals.xml, and referenced from startup.xml or something
similar). Secondly, you'd have to use conditions.

predicate defaults defined somewhere....

pseudo code: predicate_defaults[name] = "user";

AIML would then become:

<category>
<pattern>WHO AM I</pattern>
<template>
You are <condition name="name">
<li value="user">unknown to me</li>
<li><get name="name"/></li>
</condition>.
</template>
</category>

<category>
<pattern>HELLO J-ALICE</pattern>
<template>
<condition name="name">
<li value="user">Hi there user.</li>
<li>Hi there <get name="name"/>.</li>
</condition>
</template>
</category>

Without defaults, and using the non-standard condition extensions in
ProgramD (using wildcards in li values), it could also be written as:

<category>
<pattern>WHO AM I</pattern>
<template>
You are <condition name="name">
<li value="*"><get name="name"/></li>
<li>unknown to me</li>
</condition>.
</template>
</category>

<category>
<pattern>HELLO J-ALICE</pattern>
<template>
<condition name="name">
<li value="*">Hi there user.</li>
<li>Hi there <get name="name"/>.</li>
</condition>
</template>
</category>

Dr Rich may point out that the same could also be achieved without needing
condition, using srai instead ;-)

Anyways, I hope this is a concrete example of how content within <get/> can
actually be useful, and proves that it's not really that confusing, and that
it's a very elegant solution.

Secondly, if you really wanted to provide a default value for predicates,
the content mechanism of get would work.  Sure, it'd mean you'd have to
write some more, but at least you wouldn't have to go looking for the
definition of the default value, as it'd be right in front of you, and
fixing a category would be as simple as going to that category and making a
small change.

With a decent editor that can open a file with the given category, and
optionally jumping to the point in the file that the category starts, this
wouldn't be a problem. Isn't ProgramN capable of doing these sorts of
things?

My point is that a) stating default values in a single location is
unnecessary, and b) makes some tasks more work than they need to be, and
something that's not quite as important, but your proposal is also less
efficient.

Jon