Starting at www.pandorabots.com, if you have not already done
so, create an account and once logged in, create a
robot by clicking on Create a Pandorabot (it's at the top of the
screen). On the next screen, name your new robot, Full (for full of
knowledge) and make sure the radio button labeled, "Dr Wallace's
A.L.I.C.E - March 2002" is selected (see [1]). After clicking on Create Pandorabot
to create your new robot the next screen will show:
"This pandorabot is not published. When you are ready, you can publish your pandorabot to make it available
for others to chat with. You may first want to customize your pandorabot by
changing some of its properties or by
providing your own custom responses with the training interface."
Click on the Train link on the second row of menu buttons to begin
interactions with your robot. This robot already has a substantial knowledge
base (taught by Dr. Richard Wallace) so let's start by posing the question:
Human: Do you love me?
Full: Yes I love everyone.
To ask this question, type in "Do you love me?" in the text field
labeled Human: and then press Enter or click on the Ask
button to the right of the text box.
The robot knew in advance how to answer this question. How specifically did the
robot discover the answer? First the robot checked if its knowledge already
contained the question "Do you love me?" And second, finding it,
checked to see if it had been taught to respond with something meaningful.
Categories
The words in the sentence "Do you love me?" can be visualized by a
series of lines (or links) and nodes, in the knowledge web. This is illustrated
below in Picture 1.0. The links are labeled by the words (you can think of
the nodes as representing the spaces between the words) and form a chain
starting from the center of the web and moving outwards.
Finding the question in the Knowledge Web, the robot replies with the
information we taught it (residing in a Response Template - and referred to as
the template). So, in other words, the specific question "Do you
love me" can be visualized as a kind of path - beginning at the center of
the Knowledge Web and built up by a series of links and nodes, and that finally
terminates in a Response Template.
The specific path through the Knowledge Web along with the (Response) Template
is called a category. If, for example, you teach the robot to respond
with: "yes, but only when you are good" you only change the Response
Template.
More about Categories
Let's start over with a robot that has no knowledge. Create a new robot exactly
as before except that this time, name the robot Empty and select the radio
button labeled, "No initial content, the pandorabot starts with no
knowledge". Again, once the robot is created, click on Train to
start interacting with it.
Initially, Picture 1.1 shows Empty's very simple Knowledge Web. One
Category is shown and notice the Response Template contains the one sentence
"I have no answer for that". You will also notice *, <that>
and <topic> labeling the links between
the nodes. The labels *, <that> and
<topic> are special optional variants
offering enhancements to Categories. As we shall see, these special labels
extend the matching power of the Categories.
So what does this one Category do? To begin with the * label allows any interaction with Empty
to return the same response:
Human: Hello
Empty: I have no answer for that
Human: abc
Empty: I have no answer for that
More generally, words or sentences provided to the robot are called the Input
Pattern. You can visualize any sentence existing in the Knowledge Web as a
path of linked nodes, terminating with a Response Template. The robot searches
for a path of linked nodes that exactly matches the Input Pattern. When a path
is found, we say that the path matches the Input Pattern.
Default Responses
It happens often that an Input Pattern will not be found in the Knowledge Web -
yet we still want the robot to respond with something meaningful. We call this
the Default Response Template - and it typically consists of sentences
designed to keep the conversation going. We can visualize the Default Category
(a path empty of all words and it's Response Template) by Picture 1.1(pictured
above). The * will match any words. The <that> and <topic> will be explained later.
In order to teach your robot to say "Hi there!" in response to
"Hello", do the following:
- Make sure you're on the robot's Training page
(if not click on Train)
- Type in "Hello" in the box labeled Human:.
- Click on Ask (or press Enter)
- After the robot responds, type in "Hi there!"
in the box labled Empty:
- Click on Say Instead (or press Enter)
- Verify your change by clicking on (the first) Ask Again button.
Now the Knowledge Web looks like Picture 1.2
The robot has just two responses now - and is incapable of supporting its side
of an interesting conversation. Let's make some more changes. In response to you
typing anything but Hello (the one input pattern that Empty now knows about)
Empty will randomly present you with three possible responses. Type:
Human: hi
Empty: I have no answer for that
Next, click on Advanced Alter Response and in the box in the
pattern column, replace HI with *, which means that anything you type in
will be matched with a response. Now let's add three random possible
responses. In the box labeled template add:
<random>
<li>What is your name?</li>
<li>What is your favorite movie?</li>
<li>Will you buy me a drink?</li>
</random>
and click on the Submit button (at the bottom left of the page). For an
explanation of the syntax used above see
The Knowledge Web now looks like Picture 1.3.
We've changed the Default Category by changing the Default Response Template
from "I have no answer to that" to one of three randomly chosen
responses.
Like a hapless, but precocious child failing to understand what is being said,
yet unwilling to be abandoned, Empty attempts to prolong the conversation by
offering a choice of three "pick-up" lines hoping to change the
subject. Empty proffers pick-up lines randomly hoping to disguise how little it
actually knows. Check this yourself by typing anything but "Hello".
For reasons you'll see later, most of the time you'll want to avoid changing the
Ultimate Default Category. Let's go back to the beginning and start over,
and simultaneously learn how to save files.
Let's look at the file for a minute (shown below with some minor
reformatting). The first line (of header information) tell us the type of
character set and versions of XML (see [4]) we are using. The next line tells us we are
using AIML version 1.0.
Another random Category
Next we're going to create a new version of Empty and again create a
category using <random>. However, this
time we won't define it as the default category. This example is used as the
basis for the fourth
example in the next section.
Creating a New Version of Empty
First click on My Pandorabots and then in the table of robots, click the
radio button next to the name, Empty. From the drop-down menu below (it's
initially labeled, Publish) select Delete. Next click on the,
OK button on the right and confirm that you want to delete the robot,
Empty.
Then, simply repeat the procedure you followed for creating the first robot,
Empty and you'll have a fresh empty robot.
Being empty of knowledge the only thing Empty can say is:
Empty: I have no answer for that
Let's increase the possibilities for an interesting conversation by giving four
possible random responses to the next inquiry.
Human: You do love me don't you
Empty: I have no answer for that
After typing the above into the Training interface, click on Advanced
Alter Response and in the box labeled template add:
<random>
<li>I don't know, what have you done for me lately?</li>
<li>Yes, but you have to really try to make me happier...</li>
<li>Stop your whining!</li>
<li>Yes, but only when you are good to me </li>
</random>
...and as before click on the Submit button. Next, click on the Ask
Again button enough times to cycle through the complete set of
responses. The Knowledge Web now looks like Picture 1.4.
Contractions like "don't" are expanded to "do not", so:
"you do love me don't you?" is transformed to the rather awkward,
"you do love me do not you" (see [5]).