[alicebot-archcomm] Topic handling

Ernest Lergon alicebot-archcomm@list.alicebot.org
Sat, 26 Jul 2003 19:20:53 +0200


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

Proposal:

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

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

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.

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.

    Possible usage:

    <topic value="..."/>        or
    <topic push>...</topic>     or
    <topic>...</topic>             set current topic and push it
                                   on stack

    <topic/>                    or
    <topic index="1"/>             return current topic

    <topic index="2"/>             return last topic
    <topic index="3"/>             return last but one topic
    etc.

    <topic pop/>                   return current topic and pop it
                                   from the stack (last topic becomes
                                   current topic)

(Maybe we have to use something like push="1" or push="push" or
action="push" to be 100% XML compliant - any XML guru around? ;-)


For that matter another

Proposal:

Top-level that:     <that value="..."> ..... </that>      (new)

    Works like top-level <topic> and helps grouping categories.

Pattern-side that:  <that> ... </that>                    (unchanged)

    Constraint: If <that> is defined top-level, the use of pattern-side
    <that> is forbidden.

Template-side that: <that [index="#[,#]"] />              (unchanged)

    Read-only in contrast to the template-side <topic>.


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

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..

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

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

Ernest

-- 
               ProgramV - Alice on Perl - available at
                http://www.virtualitas.net/perl/aiml/

       VIRTUALITAS - Manufacturer of fine OOPPS - since 1996
*********************************************************************
* VIRTUALITAS Inc.               *       http://www.virtualitas.net *
* Ernest Lergon                  *    mailto:Ernest@virtualitas.net *
*********************************************************************
       PGP-Fingerprint 6E6F DC17 A886 342D  D63F 7880 12F5 6BA9
         PGP-Key http://www.virtualitas.net/Ernest_Lergon.asc

---------------------------------------------------------------------
SPAM ALERT                       http://www.virtualitas.net/spam.html
---------------------------------------------------------------------