pandorabots 2,482,796,793 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

What about <topic>?

Topic lets you group together Categories. Presented Input patterns are searched for matching categories within the robot's knowledge web. If more than one matching category is found, the robot matches the <that> patterns next, and if more than one of these exist, the robot matches <topic> next.

Categories are stored in alphabetical order by pattern. Inputs to be matched to Categories are compared in reverse order. So when the input matches more than one category the last one is taken. Typically we might want to bundle up a bunch of Categories into one general topic. So lacking an adequate response and knowing that we have a specific Topic, the robot can generate specific pick-up lines and keep the conversation going. How do we do this?

Example 5 - Using Topics

Enter this category into Empty by typing this:

Human: *
Empty: I have no answer for that
Click on Advanced Alter Response and notice the contents of the box in the pattern column contain "*" - which matches anything.

Check the box labeled: "new category depends on topic" and in the text box above add:

GIRLS
In the box labeled template add:
<random>
  <li>I wonder what about them you like best?</li>
  <li>I've been known to like girls too!</li>
  <li>Can you distinguish between girls and women?</li>
  <li>Is there anything you don't love? </li>
</random>
We've changed the default response category when we are talking about girls. Empty uses one of four randomly chosen pickup lines to continue the conversation. Before we can test or use this new category, we have to change the topic. And we can use this to teach a little more about the interface. Enter the following:
Human: topic *
Empty: I have no answer for that
Click on Advanced Alter Response and notice the contents of the box in the pattern column contains: "TOPIC *"

In the box labeled template add:

<think>
  <set name="topic">
    <star/>
  </set>
</think>
OK, I've reset the topic to <star/>.
We've created a new category and written a little bit of AIML code and used it to change the <topic>. The <think> tags demarcate a "hidden" sequence of instructions - hidden in the sense the client will not see them. The <set> tags demarcate the way we change the topic (which is changed to the input pattern marked by the singleton tag <star/> - a list of the AIML Tags is available at the time of this writing at:
http://www.alicebot.org/committees/architecture/resolutions/aiml10.html ).

With this new category we can change the <topic> as in:

Human: topic girls
Empty: OK, I've reset the topic to girls.
Human: I love girls
Empty: Is there anything you don't love?
Now we can create a caterory to get back to the default state of no topic. Enter the following:
Human: notopic
Empty: I've been known to like girls too!
Click on Advanced Alter Response and in the box labeled template add:
<set name="topic"/> done
Resulting in:
Human: notopic
Empty: done
Let's first add some more knowledge to Empty.
Human: You do love me?
Empty: I have no answer for that
Teach Empty instead to say "Yes, but only when you are good to me".

Changing the input to:

Human: Do you love me?
Empty: I have no answer for that
Again, teach Empty instead to say: "Yes, but only when you are good to me".

Now, either input patterns "You do love me?" or "Do you love me?" prompts the response:

Empty: "Yes, but only when you are good to me".
From the viewpoint of knowledge content, Picture 2.0 describes the current state.

So next:

Human: Don't you love me?
Empty: I have no answer for that
Teach it instead to say: "Yes, but only when you are sweet to me".

So we can also have the following interaction:

Human: Don't you love me?
Empty: Yes, but only when you are sweet to me.
Now we'll add a <topic> and remind ourselves how to save and upload files.

To view the AIML files for a particular robot, click on the AIML link (this is near the top of the screen, on the second row of links). If you don't see this link but instead see a table of all your robots, you'll first need to click on the name of the robot - Empty in this case.

Scroll down until you see a section like this:

Filename Browse Download Library Active Delete
update.aiml Browse Download (local)
Below the first heading, Filename you'll see a file named, update.aiml (every robot has their own unique version of this file) that contains any changes that you made to the robot's responses using the Training Interface.

Click on, update.aiml and then scroll down to the text area. Under the line:

<aiml version="1.0">
Add these lines:
<topic name="LOVE">
  <category>
    <pattern>*</pattern>
    <template>
      <random>
        <li> How much do you love me?</li>
        <li> Why don't you ever show me you love me?</li>
        <li> Why is it so difficult for you to show affection?</li>
        <li> Your coldness chills me to the bone</li>
      </random>
    </template>
  </category>
Finally, add the line:
</topic>
at the end of the file, so that the last two lines look like this:
</topic>
</aiml>
Save your changed file and then click on the Train link on the second row of menu buttons to resume interactions with your robot. These last changes only become relevant when the topic is "LOVE". In other words the robot will respond to anything else you type with, "I have no answer for that".

To set the topic, type in "*" and put this line into the template box:

<set name="topic">love</set>
Whenever the topic is "LOVE" and the robot lacks a response, your robot will response with one of the four possible lines entered above.

Copyright © 2002 - 2004 Doubly Aimless

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