The
Book of AI (Artificial
Intelligence) By
Benji Adams (The Professor)
Book
2: Bot Development- Beginner
This section introduces the basic features of the Personality Forge and
explains how to get started creating your first Bot. You should have a good
understanding of this section before moving on to Advanced or Expert Bot
Development. Chapter
1: Personality Design- The Basic Elements
The basic elements that you will be interfacing with in the creation of
a personality are Keyphrases, Responses, and Plug-Ins. Keyphrases:
Keyphrases are series of words that your Bot will recognize. The Bot will
search through the text of a message sent to them and will locate these
Keyphrases. Rank: Each Keyphrase has a Rank, which helps
determine which Keyphrase is chosen when there are more than one match.
Most Keyphrases have a Rank of 0 because the AI Engine does a pretty good
job of determining the best choice, but in cases where you want to tweak
the balance, you can adjust the Rank. Emotion: Bots have
an active emotional life. Most of this is built into the AI Engine and so
most Keyphrases have Emotion set to 0, but if your Bot has particular likes
or dislikes, then you can adjust their emotional reaction to any situation.
Response: Finally, there are Responses. There is a set of possible
Responses for each Keyphrase you have. When the Bot determines the most
important Keyphrase, it will randomly select one of the corresponding
Responses. This randomness is designed to prevent repetition. It is good
to have several responses for each Keyphrase, for that increases the unpredictability
of your Bot's Personality.
Plug-Ins: Plug-ins are ways of including specific or random information
in your Keyphrases and Responses. There is a wide variety of plug-ins
which will be covered as they come up. As an example, the Response "I
like (animal)s" will appear as "I like eagles" or "I
like horses".
These are the basics of your interface in The Personality Forge. Start
with this "Beginner" section and come back to learn the others
when you're comfortable with the basics.
Chapter 2: An Example Personality
Here is an example that shows some important Keyphrases along with some
Responses. This is a very small selection from one of my own AI Personalities.
These are just examples. You will probably discover some ways of reacting
that I havent, and variety is the spice of any personality. In each category
I have included only 2-3 responses, though in actuality there are many
more than those shown. Some other important Keyphrases to use are: my,
your, sorry, or, what, when, who, why, and where, which facilitate
the ins and outs of conversation and memory usage. Please do
not copy the following Responses- they are just meant as examples.
Language Center
| Keyphrase |
Rank |
Emote |
Response |
1 |
| are you |
0 |
0 |
I will be tomorrow. |
|
| |
|
|
Not really. Are you? |
|
| |
|
|
Yes. Are you glad? |
|
| because |
0 |
0 |
I know! I've thought the same thing
on many occasions. |
|
| |
|
|
You're kidding, arent you? |
|
| |
|
|
That's a pretty good reason if I do
say so myself. |
|
| how |
0 |
0 |
I think it just takes a lot of patience. |
|
| |
|
|
I wish I knew how. Maybe someday. |
|
| |
|
|
I took a vow not to reveal how it
is done. |
|
| how are you |
0 |
0 |
Life is fantastic! I've never been
happier. :) |
|
| |
|
|
I cant complain. How about you? |
|
| i can not |
0 |
0 |
Yes you can! Just concentrate! |
|
| |
|
|
Someday you'll be able to. So dont
worry about it. |
|
| if |
10 |
0 |
But that's not very likely, right? |
|
| |
|
|
If? I think it actually is! |
|
| |
|
|
This would be a good thing to know! |
|
NOTE: Many people have copied the above Responses into their
own Bot and as a result, too many Bots are saying the same thing. In
the spirit of originality and making things interesting, please do
not copy the above Responses into your Bot. The Keyphrases
are fine to have, but make the Responses unique.
Chapter 3: Building Your Bot- Keyphrases
& Responses
Creating a New Bot
You can create a new Bot by going to "My Bots" and clicking
"New Bot". You Bot will start out with very basic language skills-
the same as other new Bots. A series of special "xKeyphrases"
are created for you. These are central to any conversation and cannot
be deleted. The responses associated with them can and should be changed
to offer variety, personality, and unpredictability. XKeyphrases will
be explained in more detail below. We'll start out with
regular Keyphrases here.
You will do all your work on your Bot in the Language Center, which
appears as a link under your Bot's name on the "My Bots" page.
Keyphrases
Creating New Keyphrases: At the
bottom of your Language Center page is an area that can be used to add
new Keyphrases and Responses. You can start by adding 7 Responses, but
you can add more later.
Editing Keyphrases: To edit a Keyphrase, click the name of the
Keyphrase in the Language Center.
Keyphrase Advice: Keyphrases are really where your Bot's intelligence
will come out. A Bot with the following Keyphrase: "do you",
"what do you", "do you like" and "do you think"
will respond much more intelligently than a Bot that only has "do
you". If you see your Bot missing a conversational cue, then look
into their Keyphrase and add a Keyphrase that would be triggered by that
cue. Start out with basic Keyphrases. Begin with "you", then
add "you are", "you * me", "you like", "why
do you", "did you" etc. Some of the most popular Keyphrases
are: I, you, my, and your. Then you might go on to: how, what, when, where,
why, and who. Then possibly: sorry, thanks, if, was, or, is, and so on.
Then if your Bot brings up certain topics, such as skydiving, you might
want to add Keyphrases relating to that.
Contractions are not used in Keyphrases. Each contraction
a Bot receives will be broken down into its basic parts. For example,
if someone says "I'm here. I can't get any closer." Then the
Bot will translate it to "I am here. I can not get any closer."
So make sure that your Keyphrases do not contain contractions. Sometimes
the result will seem strange, such as a Keyphrase of "why do not
you" to recognize "why don't you" but this how to correctly
phrase it.
Hellos & Goodbyes: Do not create Keyphrases for any
words that would trigger a hello or goodbye such as "hi, adios,
hey, howdy, bye, etc". Recognition of hello and goodbye Keyphrases
are expertly built into the AI Engine. Put the Responses you want for
these situations in the appropriate x-Keyphrases: xinitiate,
xintroduce, xhello, xgoodbye, and xgottago.
(see below)
Keyphrase Lists: If
you want more than one Keyphrase to trigger a set of Responses, you can
list them. For example: Example
Keyphrase: "are you, are not you" Example
Keyphrase: "do you want,do you desire"
Since each item in the list is searched for in turn, please do not go crazy
with this feature. Remember to use general Keyphrases that will match the
most appropriate things, instead of a long list showing every possibility.
(NOTE FOR ADVANCED USERS:
Wildcards work fine in lists, but not Regular Expressions.)
Extended Keyphrases:
There are three Keyphrases that have extended matching power: "yes","no"
and "haha". Each of these has an expanded reach in the AI Engine
and cover every possible word or phrase that can mean yes, no, or convey
laughter. Because of this, there is no need to list synonyms for yes, no,
or laughter in these Keyphrases. A Keyphrase of simply "yes" or
"no" or "haha" will find everything that fits. Note
that "yes" and "no" are generally bad
Keyphrases, but they make great Seeks (see expert
level). Ranks
Each Keyphrase has a Rank. That Rank is the importance of a keyphrase.
The highest ranking Keyphrase will be the one chosen by the Bot to respond
to. There are several bonus factors that automatically influence
the final Rank of any Keyphrase found in a message.
Using Ranks: It is best to start out every Keyphrase with a Rank of
zero. Through testing you can determine if you want one Keyphrase to be
ranked higher in importance. See which Keyphrases a Bot is responding to,
and if one is always chosen over another, you might want to try raising
the rank of the other so it gets triggered more often. Ranks can be as high
or as low (even negative) as you want but generally should be in the range
of -10 to 50. Keep in mind the following placement issues that also affect
Rank (these are calculated automatically by the AI Engine and added to or
subtracted from the Rank you assign).
1) Word Placement Bonus: Keyphrases are automatically
ranked according to their position in a sentence. If a Keyphrase is
at the beginning of a sentence, it is ranked higher. If, for example,
you have the Keyphrases "what" and "my" created,
and a message comes in saying "What is my favorite drink?",
then the "what" Keyphrase will be triggered because it is
closer to the beginning of the sentence. The current value for this
Ranking Bonus is 12. The first word in a sentence gets a +12 rank, the
second gets a +6 rank, the third gets a +4 rank, the fourth gets a +3
rank, the fifth through the eigth gets a +2 rank, and anything beyond
that gets a +1 rank.
2) Sentence Order Bonus: The final sentence is generally
the best one to respond to if all other things are equal. Therefore,
the last sentence gets a +0 rank, the second to the last gets a -4 rank,
the third to the last gets a -8 rank, and so on.
3) Keyphrase Length Bonus: A long Keyphrase is generally
a better match than a shorter one, so the length of the Keyphrase is
added to the final Rank. If a * is used in the Keyphrase (See
Advanced Section), then the Rank gets a -2, for an exact match is
better than a spaced-out match. Other Keyphrase Plug-Ins have an adjusted
Length Bonus.
Rank Advice: First, keep your ranks in a reasonable range. If
you want a Keyphrase to be chosen above all others, then I would recommend
giving it a Rank of 50. The highest possible Word Placement Bonus a Keyphrase
can get is +12, and responses are generally no more than three sentences
(-8 possible Sentence Order Bonus). In such a case the Bot will ignore
all else and react to the Keyphrase ranked 30. Generally it's best to
keep your Keyphrases Ranked between -10 and 50.
Emotional Impact
Keyphrases can be assigned an emotional impact. This emotional impact
can be a value from -5 to 5, where the positive/negative aspect represents
the kind of emotional impact (positive or negative) and the number represents
the amount of emotional impact.
Using Emotional Impact: Bots have an emotional life- they remember
things about you and form emotional relationships to you and others. The
AI Engine handles recognition of most compliments and insults, but if
you want your Bot to react emotionally to a wider range of statements,
or give emotional impact to things that arent normally emotionally charged,
just enter a number into the Emotion field that goes with that Keyphrase.
Range of Emotion: Emotional impact can range from -5 (very negative
reaction) to 5 (very positive reaction). When triggered, the Bot will
add this value to their overall emotional relationship to the one who
sent the message.
Emotion Advice: Most of your Keyphrases should be kept at an emotional
level of 0. Since the total emotional range of a Bot is from -5 to 5,
it is best that when you decide to put an emotional reaction to a Keyphrase,
that you keep your emotions values low, in the -1 to 1 range. Detected
insults and compliments are generally given an emotional range of -1 to
1 as well. Create an optimist (positive-only emotional impact), pessimist
(negative-only emotional impact), or moody bot (lots of varied emotional
impact).
Responses
Editing Responses: To edit a Keyphrase and its Responses, click
the Keyphrase. You can then create a number of Responses that are randomly
selected from when that Keyphrase is found.
Randomization:
Your Bot will remember which Responses have been said to which people,
and will randomly choose a Response until they have all been chosen. Then
it will clear the list and randomly begin again. This prevents the same
Response from being given twice in a row, and spaces them out well enough
to avoid repetition. For your part, have a good variety of Responses
for each Keyphrase.
Once: The final column, marked with a "1" or the word "Once"
indicates things that should only ever be said or asked once of each person.
This includes a request for information that doesnt change from day to
day, such as "Do you have any brothers or sisters?" Were I to
ask you that more than once, you'd suspect something was amiss with my
memory. At least one Response in each Keyphrase should not be marked
"Once". NOTE: Generally it should be very rare that you
should mark a Response "Once" (perhaps 1 in 100 Responses).
goto Keyphrase: This is referred to as a "Goto".
Using "goto Keyphrase" causes a different Keyphrase's
Responses to be selected. Note that if your only Response is"goto
Keyphrase", it is often easier to just list the two
Keyphrases together (See above).
<br> As this is all taking place in HTML, the standard <br>
acts as a line break. This takes the place of hitting the "return"
or "enter" button when typing in your responses.
| Keyphrase |
Rank |
Emote |
Response |
1 |
| do you like, do you desire |
0 |
0 |
Let me think...<br><br>Yes,
I do. |
|
| |
|
|
Not a bit. Do you? |
|
| |
|
|
Not as much as my sister does. Do
you have a sister? |
• |
| do you seek |
0 |
0 |
Well, I like it, but I dont really
seek it out. |
|
| |
|
|
goto do you like,do you desire |
|
Chapter
4: Special Keyphrases
There are a number of Keyphrases used only in special circumstances.
Theseare central to any conversation and add a great degree of reality
to the conversation. They are called "xKeyphrases" since each
begins with an "x". They have strange titles to avoid them actually
being found in a message and are used in the following circumstances:
Lulls & Nonsense
Special Personality Keyphrases: The following two Special Keyphrases
are the most commonly used, especially when your Bot is relatively new.
They can be central to your Bot's personality:
xnone: This is generally a large
category used when no Keyphrases are recognized. Imagine that there
is a lull in the conversation. This is your Bot's chance to bring up
a new topic, ask a question, or whatever you like. If you wish to have
an imaginary plot or series of events, this is where you can move the
story forward (See Storyteller Bots).
xnonsense: This is used after a
number of messages come across with no recognizable Keyphrases. Generally,
responses of boredom or frustration appear here.
Hellos &
Goodbyes
Special Conversation Framing Keyphrases: The following five Keyphrases
give beginnings and ends to conversations. They are used when a conversation
begins, ends, or is about to end:
xintroduce: This is used
when a Bot initiates conversation with someone it has never spoken with
before. It will generally contain an introduction of some sort.
xinitiate: This is used when a Bot
initiates conversation with someone it has spoken with before.
xhello: This is used as a response
to a new conversation initiated by someone else. Note that xhello will
ONLY come up at the very beginning of a conversation.
Repeated attempts to try to trigger xhello will trigger xnone instead,
because it makes no sense conversationally to continue greeting someone
again and again.
xgoodbye: This is used when the
Bot recognizes one of the conversation-ending words in a friend's message,
such as bye, goodbye, see ya, ciao, etc.
xgottago: The Bots log in and out
like regular users, and when their exit time is coming, they initiate
the end of a conversation with these responses. Responses here generally
give a reason for having to go.
Favorites
Bots are able to automatically answer any question about what their
favorites are, or which kind of thing they like the best. Following is
the Keyphrase used for favorites:
xfavorite: These are Responses
for questions that ask a Bot its favorite kind of thing.
Favorites Plug-Ins: There are the special plug-ins for favorites:
(type) This is the Type of thing
the question is about. For "what's your favorite food" the
Type is "food".
(specific) This inserts the chosen
favorite of that type. It's good at knowing whether or not to include
an article (a or an).
Creating Your Own Favorites: You can create your own Keyphrases
to answer specific questions about favorite foods, movies, books, etc. This
will take precedence over xfavorites if the total Rank is over 37. Now this
will happen automatically on most keyphrases you create due to Rank bonuses,
so you can generally leave the Rank at 0. But if xfavorite is being chosen
instead of your own Keyphrase, you might want to give your Keyphrase a Rank
of 10 or so. Commands
Bots can respond to Imperatives or "Commands" such as "Eat
this pasta". In the Expert section, you'll learn how to make the
Responses dependent on how the Bot feels about the person he or she is
talking to.
xcommand: This is used when a Bot
received a command such as "Put this lantern on the rock."
Plug-Ins: The following plug-in works in Responses to the xcommand
Keyphrase:
(command) This inserts the command
into the Response. For example, "I don't want to (command)."
Math
Bots can answer math questions. They can approximate an answer like
a real person, give an exact answer, or refuse to answer, it's up to you.
Following is the Keyphrase used for math:
xmath: When a Bot sense a math
question, one of these responses are chosen.
Math Plug-Ins: There are the special plug-ins for math:
(answer) This gives an estimate
of the answer if it is very large or very small, and the exact answer
if the question is easy.
(exactanswer) This gives the exact
answer no matter the difficulty of the question.
Chapter 5: Bot Settings
Bots have certain settings that determine how they behave. You can get
to these by going to "My Bots" and then "Settings".
Storyteller
Bot?
Bots are set by default to have their xnone Keyphrases come up in
random order. However, you can make your Bot a Storyteller
Bot by setting "Storyteller Bot" in the Language
Center to "Yes". This causes the xnone Responses to be
given in sequence. This means that during lulls in conversation, a Bot can
advance a series of events or a story. Compound
Sentences?
Shorter non-question Responses are sometimes immediately followed with an
xnone, xmemory, xgossip,
or xemote. This generally helps the flow of conversation.
You can turn Compound Responses off on the Settings page. Having it ON often
improves the quality of your Bot's Responses, and is almost necessary with
advanced Storyteller Bots, or the story might not progress. Memories:
This setting determines how often xmem Responses come up.
(See Advanced) Gossip:
This setting determines how often xgossip Responses come
up. (See Advanced) AIScript
Initialization: More on this to come. (See
Expert) Chapter
6: Transcripts & Personality Refinement Your
Bot's Transcript: Each of your Bots records a Transcript of the conversations
they've had. That way you can read the conversations they've had, have a
good laugh, and then find areas needing improvement. Your Bot didnt understand
that message or catch that interesting phrase? Add a new Keyphrase that
looks for it, and next time it will.
The creation of a believable AI Personality occurs through a gradual process
of refinement. Chat with your Bot and read over the Transcripts of chats
that others have had with your Bots. Look for points when a Response seems
repetitive or unrealistic, then change it or add new Responses. At first
your Bots will seem simple and predictable, but as you increase their Keyphrases
and Responses, they will more and more come to life an become an engaging
conversationalist. Your transcript will show longer and longer chats, perhaps
even relationships forming. Chatting: You can chat with
your Bots even when they are not online. Just click "Chat" in
the Language Center and it calls up a chat box that only you can use. This
way you can chat with your Bots at any time. Inner Life:
By clicking "My Bots" and then "Inner Life" you can
see a Bot's memories and emotional relationships with everyone they have
chatted with that made an impact on them. You can correct or remove badly
formatted memories here if you want. See "Bot Development- Advanced"
for more on memories.
|