[alicebot-archcomm] Topic handling

Jonathan Roewen alicebot-archcomm@list.alicebot.org
Mon, 28 Jul 2003 13:39:28 +1200


> There is a lot of material in this proposal.

Hehe, yup .. that's our Ernest ;-)

> One point to consider: you can implement a topic stack in AIML without
> adding any new tags.  Kim Sullivan and others have already show how to
> write stacks with PUSH and POP operations in "pure" AIML.

Very true .. and whilst having builtin support of topic stacks might be
nice, I don't really think it's a necessary complication to add to
interpreters.  It's kind of like having a permutation tag/option for a
random list of elements: it'd be a cool feature, but not a required feature.

> > The topic is accessed by <topic name="..."> to group categories in the
> > AIML files and by <set/get> inside <template> to switch the topic.

Which works very well.

> > Proposal:
> >
> > Top-level topic:     <topic value="..."> ..... </topic>   (changed)

I don't see why this is a necessary change.

> >     The use of the attribute "value" is consistent in the face of the
> > overall use of name/value in AIML.

Where is value attribute used? It's <get name="name"/>, <set name="name"/>,
and the other (prolly) most common attribute used is "index". The only
occurence of value that I can think of is with <condition> and it's <li>
children.

> > Pattern-side topic:  <topic> ... </topic>                 (new)
> >
> >     This works analog to pattern-side <that> and might be more readable
> > in cases, you want to group categories by patterns.
> >
> >     Constraint: If <topic> is defined top-level, the use of pattern-side
> > <topic> is forbidden.

It's a possible thought .. an added complexity though.  Personally, I would
think that instead of being forbidden, it would override the value defined
by the enclosing <topic> tag, thereby making such an addition less complex.

> > Template-side topic: <topic [value="..."|index="#"|pop] />    (new)
> >                       <topic [push]>...</topic>                (new)
> >
> >     The use of normal set/get here interferes with user-defined
> >     predicates (variables). So it might be clearer to handle the topic
> > analog to template-side <that> with the difference, that <topic> is
> > writable.

Choosing a topic, is in essence user defined .. personally, setting the
topic with it's own specialised tag is a step backwards. I also don't see
the use of <topic/> as a getting tag, as that is what <get/> does .. get's a
value.  The <input/> and <that/> tags are not like <topic/> tags, as topic
is a predicate. Input and that are interpreter defined values, and also,
input and that have history, which topic does not (and adding of through a
stack is not something I support).

> > For that matter another
> >
> > Proposal:
> >
> > Top-level that:     <that value="..."> ..... </that>      (new)
> >
> >     Works like top-level <topic> and helps grouping categories.

This could in theory be useful. However, would it be specified that <that>
must occur inside <topic> or <aiml>, and that <topic> cannot occur inside
<that>? Or could <that> occur inside <topic> and <topic> inside <that>, but
that neither <that> or <topic> can occur nested within each other more than
once? Although this would be much more complex.

At present, I am against this proposal.

> > The new idea of having a topic-stack must be discussed. There might be a
> > need of this - see i.e.
> >
http://www.alicebot.org/pipermail/alicebot-general/2002-March/003514.html

It's already doable, if it's really needed .. AIML is much more than a
simple text in-text out interface .. it is capable of doing quite complex
manipulation if you let it.

> > And there is another issue: Top-level and pattern-side <topic/that> are
> > used to define patterns to be matched against the current values, while
> > the template-side <topic/that> return the current values: <that
> > index="1,1"/> returns the bot's last uttered sentence, which is matched
> > against the pattern-side <that>. The same applies to <topic>, so the
> > AIML writer must be careful, what to store in <topic> and what he'll get
> > back in respect of meaningfull output - e.g. pay attention to character
> > case, do not store topics like "* LIZARDS" etc..

If case matters, there are tags to manipulate case .. <lowercase>
<uppercase> <formal> and <sentence>. So paying attention to case is only for
the lazy programmer/aiml writer.

> > Maybe <topic/> should return '' instead of '*', if the last topic was
> > '*' aka 'catch all' aka 'stack is empty'.

In most cases, the asterisk value of the topic is internal to the matching
part of the algorithm.  From the specs, if the topic is empty, then for the
match path, it should be replaced by '*' .. when returned via <get
name="topic"/> it would still be the empty string. Only if set to '*'
explicitly by AIML would it return '*', in which case that's the AIML
writer's fault.

Also, because a category matches the topic "* LIZARDS" does not mean that
<get name="topic"/> returns "* LIZARDS". Instead, it should return the topic
input string: eg "REPTILES LIZARDS".

> > I think, that a topic stack is useful especially in catch-all categories
> > to return to a previous topic.

They're harder to keep track of, and what do you do when you want to
completely erase the topic stack? What if you set the topic instead of using
push, and then call pop? There are a multitude of issues that have yet to be
uncovered for such an implementation.

Jon