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: *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:
GIRLSIn the box labeled template add:
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:<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>
Human: topic *Click on Advanced Alter Response and notice the contents of the box in the pattern column contains: "TOPIC *"
In the box labeled template add:
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 ).<think> <set name="topic"> <star/> </set> </think> OK, I've reset the topic to <star/>.
With this new category we can change the <topic> as in:
Human: topic girlsNow we can create a caterory to get back to the default state of no topic. Enter the following:
Human: notopicClick on Advanced Alter Response and in the box labeled template add:
<set name="topic"/> doneResulting in:
Human: notopicLet's first add some more knowledge to Empty.
Human: You do love me?Teach Empty instead to say "Yes, but only when you are good to me".
Changing the input to:
Human: Do you love me?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.
Human: Don't you love me?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?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: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:
Finally, add the line:<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>
</topic>at the end of the file, so that the last two lines look like this:
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".</topic> </aiml>
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