So many ways to write the same thing...
What is <srai>?
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".
Let's begin by adding two new categories so that Empty responds
as follows:
Human: 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.
Human: 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, by adding the category:
<category>
<pattern>EMPTY *</pattern>
<template>
<srai><star/></srai>
</template>
</category>
Empty responds with:
Human: 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:
Human: 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:
Human: 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.
Finally, after adding:
<category>
<pattern>_ NOW</pattern>
<template>
<srai><star/></srai>
</template>
</category>
<category>
<pattern>_ RIGHT NOW</pattern>
<template>
<srai><star/></srai>
</template>
</category>
...we can now get the same answer to all the questions:
Human: 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.
Human: 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.
Human: 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.
Human: 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.
Human: 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.
Human: 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.
Human: 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.