[Aiml-programr-developers] Activity diagram, explanation of the Graphmaster etc... (long email)
Nicholas H.Tollervey
ntoll at ntoll.org
Mon Sep 10 16:28:34 EDT 2007
Guys,
As promised, I've included images (and source there-of) as attachments
to this email.
I strongly suggest you read the "formal" AIML specification found here:
http://www.alicebot.org/TR/2001/WD-aiml/
Once you've digested and understood this document then you've pretty
much got all the information you need and we will only (only?) have to
worry about implementation of the standard. The summary I've written
below is to be read as well as the standard and I hope it gives either a
good introduction before reading the standard or clarifies things.
Activity Diagram for a Request
---------------------------------------------------
(BotLifecycle.* - UML on the left, example text on right)
There are three broad steps in the life-cycle of a request to an AIML bot:
1. Normalization - prepare the raw input into a path to be fed into the
Graphmaster.
2. Query the Graphmaster - search for a <template> using the normalized
path as input.
3. Interpret / return the contents of the resulting <template> - output
something coherent and update any data-stores.
It is important to note that the Normalization process is very
English-centric. I'm assuming that different languages would be
best-normalized in different ways. As a result, it would be great if we
could implement the normalization process as some sort of work-flow
where steps could be re-arranged, added, removed and modified to the
requirements of the language of the bot (for example, certain languages
[such as French or German] might normalise by replacing accented
characters with their unaccented version). An additional consideration
is string encoding. Mauro: how good is Ruby's UTF16 support? It'd be
great if Ruby had something as simple as u"My UTF encoded string in
Python (notice the leading u)" to denote a UTF encoded string. I seem to
remember UTF support was a problem/pretty poor?
The querying of the graphmaster is explained below so I'll skip it here.
Suffice to say that this is one of the cleverest parts of the bot AND I
think the bog-standard graphmaster algorithm could be improved by making
it more capable (but I think we should concentrate on getting the plain
ol' graphmaster working properly before adding "features").
The interpretation of the XML contained within the <template> tag is
also clever but very easy to unit test as the specification is very
clear about how the tags are to work. As an aside... we can use the
<script> AIML tag to embed Ruby code into the <template> to be
interpreted at run-time. Cool eh?
Graphmaster
----------------------
(Graphmaster.* files [created with graphviz])
First of all, take a look at the picture.
Now, I did write a long and complicated explanation of the graphmaster
at this point. But when I checked it against the description in the AIML
standards document I discovered my version was so long and the standard
was so well written that I suggest you just skip to:
http://www.alicebot.org/TR/2001/WD-aiml/#section-pattern-expression-matching-behavior
It would be a good exercise to try to follow the route of the paths in
the picture of the simple graphmaster I've attached:
"Hello Mauro <that> * <topic> *"
"Hello Ben <that> Hi ALICE <topic> *"
"What is your favourite file <that> * <topic> *"
"I live in Italy <that> * <topic> *"
(Hint, the first two match the same route).
Put simply:
* Order of precedence is: "_", "word", "*".
* Match a route of child nodes (starting at root) until a <template> is
found (hint: you'll always find the path "* <that> * <topic> *").
* Interpret and pass back the template.
I'll write up the pseudo-code of Program#'s implementation (encapsulated
within the Node.cs class) in a later email (otherwise this email will go
on for pages).
Also, I'm planning the tests for ProgramR. I'll put my thoughts in
another email - again, so I don't end up clogging the list with emails
longer than "War and Peace" :-)
As always, comments, suggestions and criticism are most welcome, :-P
Best wishes,
Nicholas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: BotLifecycle.dia
Type: application/x-dia-diagram
Size: 2332 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/aiml-programr-developers/attachments/20070910/6931aa28/attachment-0001.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: BotLifecycle.jpeg
Type: image/jpeg
Size: 55020 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/aiml-programr-developers/attachments/20070910/6931aa28/attachment-0001.jpeg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Graphmaster.dot
Type: application/msword
Size: 2134 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/aiml-programr-developers/attachments/20070910/6931aa28/attachment-0001.dot
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Graphmaster.gif
Type: image/gif
Size: 22773 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/aiml-programr-developers/attachments/20070910/6931aa28/attachment-0001.gif
More information about the Aiml-programr-developers
mailing list