pandorabots 2,481,847,063 pandorabot responses served!
  Help Policies [Last Updated 9.26.2015]
Support About Most Popular

In order to follow the examples in this tutorial you will need to login using the panel to the left. If you don't have a Pandorabots account you can sign-up for an account here.

Previous | Next | Contents | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | All   Printable View

A Tutorial For Adding Knowledge to Your Robot

How about <that>?

Using <that> the robot is capable of remembering what it said in the previous interaction. And conversations can become more meaningful. <that> was named and arose from analyzing a conversational exchanges like:

Empty: Today I love you.
Human: That is wonderful.
Empty: But, will I still love you tomorrow?
Human: That is what I want to find out.
First we need a category that is useful for working with <that> expressions. Enter this category into Empty like this:
Human: say *
Empty: I have no answer for that
Click on Advanced Alter Response.

Notice the contents of the box in the pattern column are the beginning of a new category: "SAY *" (there is a space between SAY and *)

In the box labeled template add:

<star/>
...and Submit the new AIML. (Recall that <star/> is a shorter way of writing <star></star> - see
[2].) The effect of this change is to match anything. So now, "Say something" will always set <that> to "something." For example:
Human: say I love you
Empty: I love you
We are going to use this category to test our categories that use <that>.

Example 1 - Who are you?

At some point your robot might want to know who it is talking to. Here is how to do this:

Human: *
Empty: I have no answer for that
Click on Advanced Alter Response.

Check the box labeled "new category depends on that" and replace the text box's contents with:

WHAT IS YOUR NAME
Notice the box in the pattern column contains "*" meaning that any response will be matched. In the box labeled template add:
Nice to meet you <set name="name"><person/></set>.
This last bit of AIML code grabs the person's name.

Now ask the robot, "Say what is your name," to generate the state in which the next input will activate the <that> category.

Human: say what is your name
Empty: what is your name
Human: Mr. Lovejoy
Empty: Nice to meet you Mr. Lovejoy.

Example 2 - YES and NO Questions

Use <that> for categories that seek yes and no responses. Here is an example for "yes" questions:

Human: yes Empty: I have no answer for that
Click on Advanced Alter Response.

Check the box labeled "new category depends on that" and replace the text box's contents with:

ARE YOU LOOKING FOR LOVE
Notice the box in the pattern column contains "YES". In the box labeled template add four random responses:
<random>
  <li>Aren't we all looking for love?</li>
  <li>Well you've come to the right place!</li>
  <li>And what kind of love are we looking for today?</li>
  <li>Well I am overflowing with Love for you today </li>
</random>
Now, the robot should be able to recognize the "yes" response:
Human: say are you looking for love?
Empty: are you looking for love
Human: yes
Empty: Well you've come to the right place!

Example 3 - Discovering what knowledge to add to a Robot

The AIML tag <that> refers to whatever Empty last said. Use <that/> and a default template to add new knowledge:

Human: Why
Empty: I have no answer for that
Enter as the alternative response:
"<that/>"? Why?
and click on Say Instead.

This category enables the following dialogue fragment:

Empty: Do not ask me any more questions please.
Human: Why?
Empty: "Do not ask me any more questions please"? Why?
The botmaster notices the fragment and creates the new AIML category:
<category>
  <pattern>WHY</pattern>
  <that>DO NOT ASK ME ANY MORE QUESTIONS PLEASE</that>
  <template>Because I would rather talk about you.</template>
</category>
Now the next client who asks "Why?" to the robot's request will active the new <that> category:
Empty: Do not ask me any more questions please.
Human: Why?
Empty: Because I would rather talk about you.
This style of conversational analysis does not presuppose that we know when the client will say "Why?"; rather it looks backward to identify cases where the "Why?" appeared following one of the robot's statements. Having identified the conversation point, the botmaster creates the new category.

Example 4 - Context Sensitive Patterns

Let's look at a slightly convoluted example. Following on from an earlier example in the previous section, click on Ask Again enough times to get the response in the first exchange below:

Human: You do love me don't you
Empty: Yes, but you have to really try to make me happier...
Human: But I try so hard to please you...
Empty: I have no answer for that
Click on Advanced Alter Response

Check the box labeled: "new category depends on that" which should contain "YES BUT YOU HAVE TO REALLY TRY TO MAKE ME HAPPIER" Notice the box in the pattern column contains: "BUT I TRY SO HARD TO PLEASE YOU"

In the box labeled template add:

And sometimes you succeed, it's just that you could do so much better.
So only when the robot's random response matches the interaction in the next exchange:
Human: you do love me don't you?
Empty: Yes, but you have to really try to make me happier...
You can type in:
Human: But I try so hard to please you ...
Empty: And sometimes you succeed, it's just that you could do so much better.
Except for the case mentioned above, the robot's response to:
Human: But I try so hard to please you ...
will be:
Empty: I have no answer for that
Picture 1.5 shows the situation.

So, <that> modifies a category - meaning match the category only if the robot said what follows the <that> in the previous utterance. Continuing with this example:

Human: You just don't appreciate me, - you take me for granted and walk all over me...
Empty: I have no answer for that
Click on Advanced Alter Response

Check the box labeled: "new category depends on that" (which now contains the contents of last Response Template): "AND SOMETIMES YOU SUCCEED IT IS JUST THAT YOU COULD DO SO MUCH BETTER"

Notice the contents of the box in the pattern column are the beginning of a new category "YOU JUST DO NOT APPRECIATE ME YOU TAKE ME FOR GRANTED AND WALK ALL OVER ME"

In the box labeled template add:

If you worked harder it will help me to develop more enthusiasm for appreciating you - what do you want me to do? Fake my appreciation or really feel it?
With these changes the following interchanges are possible (click on Ask Again enough times to generate Empty's (random) response in the first exchange below):
Human: you do love me don't you?
Empty: Yes, but you have to really try to make me happier...
Human: but I try so hard to please you ...
Empty: And sometimes you succeed, it's just that you could do so much better
Human: You just don't appreciate me, - you take me for granted and walk all over me...
Empty: If you worked harder I might be able to develop a little more enthusiasm for appreciating you - what do you want me to do?
Fake my appreciation or really feel it?"
Picture 1.6 shows the current state of knowledge.

The contents of the file update.aiml now include:

<category>
  <pattern>YOU DO LOVE ME DO NOT YOU</pattern>
  <template>
    <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>
  </template>
</category>
<category>
  <pattern>BUT I TRY SO HARD TO PLEASE YOU</pattern>
  <that>YES BUT YOU HAVE TO REALLY TRY TO MAKE ME HAPPIER</that>
  <template>
    And sometimes you succeed, it's just that you could do so much
    better
  </template>
</category>
<category>
  <pattern>
    YOU JUST DO NOT APPRECIATE ME YOU TAKE ME FOR GRANTED AND
    WALK ALL OVER ME
  </pattern>
  <that>
    AND SOMETIMES YOU SUCCEED IT IS JUST THAT YOU COULD DO SO MUCH
    BETTER
  </that>
  <template>
    If you worked harder it will help me to develop more enthusiasm
    for appreciating you - what do you want me to do? Fake my
    appreciation or really feel it?
  </template>
</category>

Copyright © 2002 - 2004 Doubly Aimless

Previous | Next | Contents | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | All   Printable View