So many ways to write the same thing....

You can write a sentence with the same meaning in many different ways. Most people would accept the following sentences as roughly equivalent:
    Empty, can you please tell me if you are seeing anyone else right now
    Empty, can you please tell me if you are seeing anyone else now
    Empty, can you please tell me if you are seeing anyone else
    Empty, please tell me if you are seeing anyone else
    Empty, tell me if you are seeing anyone else
    Empty, tell me are you seeing anyone else
    Empty, are you seeing anyone else
    Are you seeing anyone else

And this is an example of a general problem - how do you enter all the categories for inputs with equivalent meanings? Or how do you answer these kinds of questions? No one has provided a satisfactory mechanism for finding all the similar sentences. Here is what can be done though. In this example we are going to use a new tag and introduce the "_" character. Earlier we wrote that "*" matches any pattern. "_" is another form of "*" and is useful for matching patterns at the ends of sentences. The category containing " * now" will be matched after the one containing " _ now".

Lets begin by adding two new categories so that Empty responds as follows:
   You: Are you seeing anyone else?
    Empty: Everyone I run into is either someone I've already seen or someone I am going to see in the future
    You: You are seeing anyone else?
    Empty: Everyone I run into is either someone I've already seen or someone I am going to see in the future

Then, adding the
   <category>
    <pattern>Empty *</pattern>
    <template>
    <srai><star/></srai>
    </template>
    </category>

Produces:
   You: Empty, are you seeing anyone else?
    Empty: Everyone I run into is either someone I've already seen or someone I am going to see in the future

Adding:
   <category>
    <pattern>_ tell me *</pattern>
    <template>
    <srai><star/></srai>
    </template>
    </category>

Produces:
   You: Empty, tell me are you seeing anyone else
    Empty: Everyone I run into is either someone I've already seen or someone I am going to see in the future

Adding:
   <category>
    <pattern>_ tell me if *</pattern>
    <template>
    <srai><star/></srai>
    </template>
    </category>

Produces:
   You: Empty, tell me if you are seeing anyone else
    Empty: Everyone I run into is either someone I've already seen or someone I am going to see in the future

Adding:
    <category>
    <pattern>_ tell me if *</pattern>
    <template>
    <srai><star/></srai>
    </template>
    </category>

Produces:
    You: Empty, tell me if you are seeing anyone else
    Empty: Everyone I run into is either someone I've already seen or someone I am going to see in the future

Adding:
    <category>
    <pattern>_ now </pattern>
    <template>
    <srai><star/></srai>
    </template>
    </category>
    <category>
    <pattern>_ right now </pattern>
    <template>
    <srai><star/></srai>
    </template>
    </category>

With these categories we can now get the same answer to all the questions:
    You: Empty, can you please tell me if you are seeing anyone else right now
    Empty: Everyone I run into is either someone I've already seen or someone I am going to see in the future
    You: Empty, can you please tell me if you are seeing anyone else now
    Empty: Everyone I run into is either someone I've already seen or someone I am going to see in the future
    You: Empty, can you please tell me if you are seeing anyone else
    Empty: Everyone I run into is either someone I've already seen or someone I am going to see in the future
    You: Empty, please tell me if you are seeing anyone else
    Empty: Everyone I run into is either someone I've already seen or someone I am going to see in the future
    You: Empty, tell me if you are seeing anyone else 
    Empty: Everyone I run into is either someone I've already seen or someone I am going to see in the future
    You: Empty, tell me are you seeing anyone else
    Empty: Everyone I run into is either someone I've already seen or someone I am going to see in the future
    You: Empty, are you seeing anyone else
    Empty: Everyone I run into is either someone I've already seen or someone I am going to see in the future

So, what has happened here? We've simplified progressively more complex sentences into two "standard" sentences: (Are you seeing anyone else? and You are seeing anyone else?)

The general technique is called recursion - and it means applying the same solution - in this example <srai><star/><srai> over and over again. Recursion is useful for a variety of tasks. We will just mention a few here. More details can be found in The Anatomy of Alice.

1. handling multiple sentences - the following exchange is generated with the categories below. (Your robot can handle multiple sentences - and does it by responding to each one in turn in separate output lines.)
    You: Empty, are you seeing anyone else
    Empty: Everyone I run into is either someone I've already seen or someone I am going to see in the future
    You: I see.
    Empty: I am glad you see.
    You: Why do you think you can get away with that?
    Empty: Full disclosure is always best don't you think?

    <category>
    <pattern> I see *</pattern>
    <template> <srai> I see </srai>
    <srai><star/></srai> </template>
    </category>
    <category>
    <pattern> I see </pattern>
    <template>I am glad you see</template>
    </category>
    <category>
    <pattern> why do you think you can get away with that? </pattern>
    <template> Full disclosure is always best don't you think?</template>
    </category>


2. Spelling and Grammar corrections: Often we want to correct spelling errors or suggest alternate forms of grammar - and here is one way to do it:
    <category>
    <pattern> your a wasting my time </pattern>
    <template> you mean you are..? ...<srai>
    you are <star/> </srai> </template
    </category>



3. Sometimes we want the robot's response to be determined by just one word (a Keyword) you've typed. Here is an example in which the keyword is "love":
    <category>
    <pattern> love </pattern><template> tell me more about what you are seeking.</template>
    </category>
    <category>
    <pattern> _ love </pattern><template><srai>love
    </srai></template>
    </category>
    <category>
    <pattern> love _ </pattern><template>
    <srai>love </srai></template>
    </category>
    <category>
    <pattern> _ love *</pattern><template>
    <srai>love </srai></template>
    </category>

The first category matches the single word input of love. The second and third categories match a sentence ending in love and beginning in love respectively. The final category matches a sentence in which the word love appears.

 

Footnote 0.

The options Standard AIML Sept 2001 and Dr Wallace's A.L.I.C.E march 2002 are two sets of knowledge. The first is organized into separate files and easy to change -and is suitable for experts. The second is the knowledge Dr. Wallace used to win the 2002 Loebner prize.

Footnote 1.

Here are more details of the transformation. The inquiry "do you love me", is transformed, removing any punctuation and converting it to upper case: "DO YOU LOVE ME". So "do you LOVE me" and "DO YOU love me" are equivalent. For multiple sentences, finding the sentences is the first part. The inquiry "Do you love me dr.wallace? ms.mary said you might..." is transformed to "Do you love me doctor wallace? ms marry said you might". Then each sentence is separately processed. Apostrophes are removed from contractions so "I'm in love with you" is transformed to "I am in love with you".

Japanese is written without spaces between the words. So spaces are first inserted. When the bot has been set up to process Japanese and English, a sentence like "let's see if you really do" is transformed to "let ' s see if you really do"

Footnote 2.

Words inside brackets < and > like "<random>" are called XML tags and specify how the answer is to be processed. We've provided only a few such tags. <li> specifies an element in a list - and this example has a list with 3 elements - namely the three sentences. Each tag is expected to have a closing tag, typically specified as in </random>. It sometimes happens that nothing falls between an opening tag and a closing tag, and so the two tags can be replaced as in this example <star> </star> = <star/>  That is, the two tags on the right can be replaced by the simpler tag on the left.

Footnote 3.

XML and AIML are programming languages. We implemented AIML (Artificial Intelligence Markup Language) a non-standard evolving markup language for creating chat robots, created and supported by the ALICE Foundation and located at www.alicebot.org. The primary design feature of AIML is brevity and simplicity. The pattern matching language is very simple, for example permitting only one wild-card ('*') match character per pattern. AIML is an XML language, meaning that it obeys certain grammatical meta-rules. The choice of XML syntax. permits integration with other tools such as XML editors.

 

Glossary

Input Pattern - The input sentence (or sentences) provided to the robot.

Template - an abbreviation for response template

Response Template - The Response Template is either a response or a program to generate a response.

Category - An Input Pattern (including optional variants of <that> and <topic>, along with a Response Template

Pattern Matching - A capability of matching input sentences against stored sentences

Knowledge Web (AKA Graph Master) - A representation of the categories in a Pandorabot

Ultimate Default Category - When the input sentence fails to match any category

Default Category - <topics> and <that> can each have a default category

Default Response Template - what is said when nothing is matched.

XML - a markup/programming language

AIML - a markup/programming language implementing knowledge content. AIML is a subset of XML.

 

Appendix


Using Advanced Alter Response - the Details

The top 9 boxes containformation about the Category that an input sentence (pattern) matched.

Input ... shows the input text (pattern) that the robot received

Matched ... shows the pattern (and Category) that matched the input pattern

Action ... shows the reply - the Response Template part of the matching Category. <that> and <topic> parts of the matching Category are specified in the boxes
too.

New AIML... A pattern - you can either accept or revise it - in effect you are creating a new category. Text in the first box is automatically surrounded by <pattern> and </pattern> - so you need not enter them. You may also specify <topic> and <that> parts of the category. Again the text is surrounded by the <that> and <topic> aiml tags automatically.

Template ... The Template Response Box - specify the actions for a given Input Pattern. The buttons <think>, <random>, etc save you from typing in the AIML.
Also, anything in this box is automatically surrounded by <template> and </template>.

Seven editing buttons provide some shortcuts for writing the template:
    <think>: inserts
    <think>
    <set name="it">
    <set name="topic">
    <person/>
    </set>
    </set>
    </think>

in the template.

<random>: inserts an AIML template for a three random choices inserted between the tags
    <li> and </li>.
    <random>
    <li></li>
    <li></li>
    <li></li>
    </random>
    <img>: inserts <img src=""></img>

Put a pathname between the double quotes to provide a picture.
    <sr/>: inserts <sr/> which is another abbreviation for <srai><star/></srai>.
    <srai>: inserts <srai> </srai>, and you insert text between these tags.

Reduce: shortens the input sentence (pattern) one word, by removing the last word before the wildcard. For example, YOU ARE VERY * reduces to <srai>YOU ARE <star/></srai>. Use this to eliminate adverbs and other logically superfluous words.

Clear: clears the template.

 

Exploring Categories

Under "botmaster control" you will find a link labeled "explore". It is a rudimentary mechanism for exploring the categories that exist in a given knowledge web. Use this link to find already existing categories that will be matched by input patterns. The categories found are shown in their internal lisp-based form rather than the xml-based form.

 

References

Artificial Intelligence Markup Language (AIML) Version 1.0.1

http://alicebot.org/TR/2001/WD-aiml/

AIML Pattern Matching Simplified - http://alicebot.org/documentation/matching.html

Don't Read Me - http://alicebot.org/articles/wallace/dont.html

AIML 1.0 Tag Sets (July 16, 2001) http://www.alicebot.org/committees/architecture/resolutions/aiml10.html

AIML Primer - This document is a "work in progress" Last update: 9JAN2002 http://www.alicebot.org/documentation/aiml-primer.html

The Anatomy of ALICE - pending publication - available from Dr. Richard Wallace at www.alicebot.org