Archbot - A Chatterbot building Architecture, or "Bot Architecture" using XML, MSAgent, SAPI and WSH.
Introduction
Archbot is a chatterbot building system or "architecture" that allows the user to build voice controlled, scriptable, animated chatterbots using XML files that provide the bot's specifications. The user can type via keyboard or speak via microphone t
o his/her computer, and have it talk back, using an animated Agent, as well as execute scripts written in either VBScript or JScript, that perform tasks, letting the user literally control his/her PC by talking to it. Bots with different brains, persona
litie
s, and even different genders can be built using this architecture. There are two versions of this project, a SAPI (speech recognition) and a Non-SAPI (keyboard typed dialog) version. BEFORE YOU BEGIN, you need to read the "Main Document". It provides a
"Quick Start Guide" that lets you get where you need to go quickly.
Quick Start Guide
This section is provided to let you know what each section of the paper talks about, letting you skip around the document to go where you want to go. If you want to learn more about the history of Chatterbots and the current state of bot technology,
read the "History of Chatterbots" and "Current Technologies" section. If you want to Learn more about the project's purpose and what it is, read the "Project Description" section. The "ArchBot User Manual" will allow a User to get started using the appl
icati
on right away. Then we get into the "Project Requirements" section where we discuss the Methodology used as well as the technologies used in the project. A small study of the English language follows this, giving the user a brief tutorial on concepts of
the English language, that are essential to understanding the Natural Language Processing utilized in the project.
The "Project Application Development" section contains information for programmers wishing to learn how to build a bot architecture engine and how to expand and extend it. If you wish to learn how to build a bot and the bot's brains through the XML f
iles, check out the section "Building a Bot". Ideas for future updates/enhancements and a little paragraph about me are provided at the end of this paper.
History of Chatterbots
ELIZA
During the 1960s Joseph Weizenbaum created ELIZA. ELIZA created a storm of public interest in AI, as it helped thousands overcome their personal problems. ELIZA was a psychiatrist, particularly one that posed analytical questions for every answer
the user gave it. Though sometimes they may have seemed ambiguous, people actually felt ELIZA could take care of their needs just as well as any other therapist. They became emotionally involved with ELIZA, even Weizenbaum's secretary demanded to be lef
t alo
ne with the program. When people had started calling ELIZA intelligent, Joseph Weizenbaum went into an uproar. Technically, ELIZA was actually unable to understand people's personal problems to the depth of any other human being. ELIZA could only manipu
late syntax (grammar), and check for some key words. Certainly, if someone had no knowledge of ELIZA being a program, one could easily conclude that it behaved like a human conversing, although it never really neccessary understood everything to the det
ail t
Turing Test
In 1950, Dr. Alan Turing, a British mathematician who is now considered the "Father of AI" proposed the "Turing Test" for intelligence. Simply put, the Turing Test boils down to the question: "Can this machine convince the human to think that it's
human?". Specifically, the machine is a natural language system that converses with human subjects. In the Turing Test, a human (the judge) is placed in one room, and the machine/or another human is placed in another. The judge may ask questions or ans
wer q
uestions posed by the computer/or another human. All communication is done through a terminal, input is done by typing. The judge is not aware whether or not the subject that he/she is talking to is either a human or a computer before the conversation b
egins. Supposing that the judge was conversing with a computer, during and after the conversation, he/she must be "fooled" into thinking that the machine is a human in order for the machine to pass the Turing Test. There are actually very many pitfalls
to th
Problems with AI then
I don't know where to begin on how technology has changed in the last half century, much less what has happened in the last decade with the developments in computers, technology and AI. Back then we didn't possess the raw computing power, much les
s the advances in speech recognition, text to speech, neural nets, easy string manipulation algorithms, and graphical animation. But computers have only really been around for 60 years so we wouldn't expect to much of them at first. People had plenty of
high
expectations as to what technology would be like in the year 2000. Some of those dreams are being realized today while many others are still far away.
Current Technologies
Alice
In the 1990's, Dr. Richard Wallace developed a chatterbot system that could be written in an XML specification called AIML, short for Artifical Intelligence Markup Language, and "Alice" was born. Today, Alice and her many derivitives, or "clones",
permeate the web today as artificial site greeters, sales representatives, celebrities like Elvis, The Beatles, and as a novelty item on the movie web site for "AI - Artificial Intelligence". Alice runs similiar to Eliza, with more tricks and a bigger
brain
this time, and is a very popular chatterbot in the AI community today. Probably the biggest factor of success for Alice is the fact that she's open source, drawing on many resources around the world to contribute to her further success. Another big not
e is the fact that Alice has won the Loebner Contest, mentioned below, for two years in a row as of this writing. There are around 25000 templates in her brain, and growing. Dr. Wallace's unique one liners as responses is what gives Alice her unique per
sonal
Loebner Contest
Today, the Loebner Contest is an instantiation, a modern version of the Turing Test. The criticisms surrounding the Loebner contest deals with how the Turing Test is carried out. The goal of the contestant is to fool or trick the judge into thinki
ng that his program is a human. Such a prospect does not encourage the advancement of AI. For example, messages are transmitted via text, as the subject (human or computer) types, the judge sees the text that is being typed, live. Thus, many contestants
have
been forced to emulate typing conditions of humans, i.e. text that is outputed comes out at varied speeds, sometimes words must be misspelled and corrected, incorrect punctuation is often used etc. Even then, the programs in the contest usually talk ab
out only one subject (to talk about everything present in our culture is simply impossible, at least for a natural language system that understands only words, syntax and semantics and not really what they look like, what some objects really do etc.). I
f the
Problems with AI today
Although we have seen many advances in technology, especially with AI, we still do not possess software that unequivocally possesses the ability to produce conversation at a human's intelligence level. Chatterbots have utilized Markov chains, neur
al nets, language disambiguation parsing, as well as the more classic methods of ELIZA like Case Logic, blackboards, NLP, and part of speech tagging. Huge claims to fame from corporations of "child machines", "common sense databases", and other AI and N
LP re
lated topics have resulted in nothing really more than a research project whose funding gets cut. Nobody and nothing can purport to have a machine that actually THINKS like a human today. At any rate, we still do not possess a software that can pass the
Turing Test, or display strong, genuine artificial intelligence in natural language conversation. We are however, producing better chatterbots and chatterbot systems.
Project Description
The intent of this project is to be able to develop chatterbots through a "bot architecture" that can provide numerous services from a Chatterbot interface. This interface will bring together the technologies of Voice Recognition, Natural Language Pr
ocessing, Text to Speech, Animated Agents, and Windows Scripting Host. The interface provides for voice or keyboard input from the user and controls the MSAgent's movement, animations and speech, as well as scripted commands being executed by WSH. The s
cript
can be in any script language supported by Windows Scripting Host.
The "bot architecture" will enable bot authors to build bots that have different brains, different personalities, different animated Agents, even different bot genders, through the use of various XML files. This bot architecture has been developed to
ease the maintainability issue that comes with handling huge brainfiles, as well as mechanisms providing for numerous NLP tasks like the task of Symbolic Reduction. Bot authors can develop brainfiles that can be written to provide endless possibilities
of r
andomness and variation in the bot's responses and the Agent's animation. Bot authors also have the ability to write linear conversation trees. This means giving the bot author the ability to have the bot actually carry on a conversation past one senten
ce. There are many possibilities of what the bot can do in terms of scripting, and bot authors can choose to script their bots in whatever scripting languages are installed on their PC, usually in most cases it's VBScript or JScript.
ArchBot User Manual
The User Interface
The File Menu
Open Bot - This presents the "Open Bot" dialog allowing the user to select a bot file (*.xml).
Save Conversation - This presents the "Save Conversation" dialog allowing the user to save conversation's that the user and bot have.
Speech is On/Off - this toggles whether Speech Recognition is on or not. (SAPI version only)
Show/Hide Agent - this toggles "Show/Hide" display of the MSAgent loaded.
Agent Properties - this presents the user with a dialog allowing the user to change the MSAgent's properties.
Exit- this Exits the Archbot application.
The Help Menu
The About Screen - this displays information about the Archbot Project.
User Input Textbox - This is at the bottom of the main interface and allows the user to type in their utterances and their side of the conservation. Instead of typing, the SAPI version allows you to talk instead of type (SAPI version only). While
the Agent is talking, speech recogonition is turned off. When the Agent finishes speaking, the speech recognition is turned on, and the user can speak then. When the user's speech is recognized, the input is captured and sent to the NLP engine to respon
d to,
and speech recognition is turned back off, and the Agent speaks the response. This process is continued throughout the conversation. If you wish to start talking before the Agent is finished speaking, hit the Scroll Lock Key, and the Agent stops talkin
g and speech recognition is turned on (see below).
Conversation Output Textbox - This is at the top of the main interface and allows the bot to display the conversation that the user and it has.
The Splitter Bar - This is in the middle of the User Input Textbox and the Bot Output Textbox to seperate the two. You can adjust the position of the splitter bar with the mouse cursor.
The Scroll Lock Key - Use this key to interupt the agent and speak before he/she finishes. (SAPI version only)
Bot Files
Provided with the application are four bots that were made using four popular MSAgents.
ArchBot\Bots
Genie.xml
Merlin.xml
Peedy.xml
Robby.xml
Project Requirements
Selected Methodology
In addition to the tools and technologies used in the Selected Technologies part of this paper, the methodology we use here is based on the need for the ease of use and understandability of an architectural system while finding ways of doing the j
ob in pure, easy to understand Visual Basic 6.0. Visual Basic was used in this project for its ease of use and understanding but the project could exist in other languages. Obviously we don't need to reinvent the wheel in terms of quality of product at
the r
ight price because Microsoft provides almost everything used here: MSAgent 2.0, MSXML 4.0, SAPI 5.1, and Windows Script Hosting components, get this, for FREE! The code used to invoke these technologies are not very hard to program and allow us to take
for granted that these components will do their job bug free, allowing us to concentrate on NLP coding. Some of the algorithms used in this project are written for ease of understanding, not speed. The primary purpose of this first prototype is to provi
de ma
The project could certainly be enhanced ten fold by more efficient algorithms but it's programmed the way it is so a programmer doesn't have to jump around too much in the code. The core engine consists of 22 functions. This said, for the most par
t, the algorithms and code are pretty fast and efficient as is. A lot of functionality like Internet Surfing, EMail, Reminder System etc. was not coded here to present the project code as simply as possible. However, once a programmer learns how the sys
tem o
perates, he/she can easily expand it to do so much more.
Selected Technologies
VB 6.0 - This is the development environment of this project.
XML 4.0 - XML 4.0 is used to formulate all the documents and their SAX Readers used by the bot architecture.
MSAgent 2.0 - This is the agent technology used for the Animation and Text to Speech technologies of the bot.
SAPI 5.1 - This is the Speech API used for the voice recognition. (SAPI version only)
WSH 5.5 - This is the Windows Scripting Host control that executes the bot's scripts.
RichTextFormat 6.0 - This Rich Text Format textbox control is used for display and opening and saving files.
It should be noted that SAPI 5.1 only runs on the following systems:
Windows XP Professional or Home editions; all language versions.
Windows.NET Server editions; all language versions.
Microsoft Windows 2000 Professional Workstation or Server; all language versions.
Microsoft Windows Millennium edition.
Microsoft Windows 98 all editions.
Microsoft Windows ® NT Workstation or Server 4.0, service pack 6a.
Windows 95 or earlier is NOT supported.
Therefore, Win95 users should use the Non-SAPI version (typed text only). Alternatively, the Win95 version could have SAPI 4.0 version programmed for the Voice Recognition part. This project only has SAPI 5.1 programmed because it's easier to use
and a better, more accurate voice recognition engine. Below is a listing of URLs that let you download the technologies used in this project for FREE.
SAPI 5.1
http://www.microsoft.com/speech/download/sdk51/
Windows Script Host (WSH) 5.5
http://www.microsoft.com/msdownload/vbscript/scripting.asp
MSAgent 2.0
http://www.microsoft.com/msagent/downloads.htm
http://www.msagentring.org/setup.htm
MSXML 4.0
http://msdn.microsoft.com/downloads/default.asp?url=/downloads/sample.asp?url=/msdn-files/027/001/766/msdncompositedoc.xml
Language Study
The following is a listing of the English Language's Parts of Speech. While there are certain categories that contain an almost infinite amount of words, there are other categories that not only contain smaller and more managable word lists, but comp
rise a huge proportion of word usage spoken in everyday conversation.
Nouns - Person, Place, Thing
Common - Does NOT tell us the particular person, place, thing.
Abstract - qualities, actions, ideas.
Concrete - things that you can see or touch. Plurals are in here.
Collective - singular, but refer to a group of persons or things.
Proper - Names and Designations of People, Places, Things.
Mr. Binning, Golden Gate Bridge, Baton Rouge, SACWIS
Pronouns - take the place of nouns.
Antecedent - the noun that is replaced by the pronoun.
Personal - Names a person, place or thing.
Subject Forms
I,you,he,she,it,we,they,you all
Object Forms
Me,you,him,her,it,us,them,you all
Subject Possesive
My,your,his,her,its,our,their,you alls
Object Possesive
Mine,yours,his,hers,its,ours,theirs,you alls
Compound forms
-self,-selves
Intensive - gives emphasis
Reflexive - expressing action turned back
on the subject
Relative - connects two clauses (groups of words containing a subject and a verb), and relates back to a noun or pronoun in the preceding clause.
that, what, which, who, whom, whose,
Compound Relative Pronouns:
whatever,whichever, whoever
Interrogative - used to ask questions, they ask the identity, the nature, or the possessor of whatever is in question.
what, which, who, where
Definite - used to answer the question "which?", they refer to a particular person or thing.
That, these, this, those
Indefinite - used to answer the question "which?", they do not refer to particular persons or things.
Somebody, neither, both, each, many, one, other
Adjectives - used to modify, or to give a more exact meaning to, a noun or a group of words acting as a noun.
Descriptive - describes a quality or condition of a noun.
short,old,grassy,black,sad
Limiting - singles out the object talked about, or indicates quantity. Such as pronouns, numbers, articles (a, an, the).
this,that,two,this,those
Phrases and clauses - adjective word groups.
The man [with the green hat] saw me.
Adjectives modify a group of words acting as a noun.
"[Going to school] is [necessary]".
(noun) (adjective)
Verbs - expresses action or a state of being
Linking Verbs - used to join the subject with a word, in order to make a statement.
appear, be, felt, grow, look, remain, seem, smell, taste, stay
Auxiliary Verbs - used with other verbs to form a verb
tense, voice or mood.
have, be, do, may, will
Transitive - verb that takes an object
she sang the song.
he lifted the hammer.
Intransitive - does not take an object
she could not sing.
they ran fast.
Adverbs - used to modify, or to give a more exact meaning to, a verb, adjective, other adverbs, entire sentences or clauses.
Interrogative - adverbs that ask questions.
Conjunctive - adverbs that connect two clauses and modify one.
Prepositions - word or group of words that show the relation of one word (usually a noun or pronoun) to some other word in the sentence.
in,for,on,to,alongside,concerning,in spite of,as far as,toward, before, at, between, by, down, for, in, of, over,up, with
Conjunctions - used to join together words or word groups.
Coordinating - links two words or word groups that are gramatically the same.
and,but,yet,or
Correlative - when two coordinating conjunctions are used together.
Both...and,either...or,though...yet
Subordinating - connects a subordinate clause to the main clause of a sentence.
because,as,before,if,since,unless
Interjections - these bear no grammatical relation to other words in a sentence, they all express emotion.
Ah!,Alas!,Oh!,Ouch!
Now that everyone has had their mini English 101 course, we can talk about pronouns, prepositions and the like. Handling these parts of speech in conversation is one of the many requirements for Natural Language Processing software. The important spe
ech parts are those "small lists" of words we were talking about earlier, that contain a manageable list of words that cover a large part of language. The lists are: Pronouns, Prepositions, Conjunctions, and Interjections. Pronouns are special in that t
hey a
re words used to talk about people, a common conversation topic. In this project we handle them as a special XML list with replacement values that allow us to do the main thing with pronouns that we need to do, handling the I -> YOU set. Whenever we enc
ounter some form of I-You, we switch I for You and vise versa. Phrases that contain pronouns and common verbs can span a huge territory of language in natural language conversation. The Prepositions listing is a half a page listing of words that covers
one t
Project Application Development
This is the section of the paper that explains how this system works. In the first section "Bot Algorithm Requirements", we learn all about XML and what the SAX Reader is. We also look at XPath syntax and provide a short list of common VB commands an
d functions used in this application. Then we go into a Conceptual Overview of the system, providing a high level look at the processing that goes on in main application. We then delve into the most important part of all this code, the natural language
proce
ssing processes in the "NLP Detail Design" section. This, along with the highly commented project prototype, provides us with the basic structure and it's coding.
Bot Algorithm Requirements
XML DOM Document 4.0
This is the main object of the MSXML 4.0 control, an XML DOM Document. It will contain the contents, the "nodes" of the XML Document. To begin with we declare an object of type DOMDocument40:
Dim xmlBotDocument As New DOMDocument40
We can then load a textual xml file with a *.xml extension into this object
rs = xmlBotDocument.Load(filename)
If we get no errors, we can then proceed to manipulate the xml document through the DOMDocument40 object. We can obtain information from the xml document by either XPath syntax used in the selectNode methods, or SAX Readers using their content
handlers to parse the XML document.
XML SAX Reader Parsing
Before we start in on SAX, lets define it. It is a "XML reader" that can parse a XML Document and examine each node and perform operations on these nodes and their values by using application code such as Visual Basic, C++, Java, etc. To parse
an XML Document with a SAX reader, we make the following VB call:
SAXReader.parse XMLDocument
where "SAXReader" is a SAXXMLReader object and "XMLDocument" is a XMLDOMDocument object that contains an XML Document. Before we can parse the XMLDocument with this call, we have to assign SAXReader's "contentHandler" class module. We present V
B code to illustrate, first off let's declare our SAXReader object:
Dim sxrSAXReader As New SAXXMLReader40
Next, we declare "contentHandler1" as a new instance of a VB Class Module called "clmContentHandlerModule". This Class Module is going to be sxrSAXReader's content handler.
Dim contentHandler1 As New clmContentHandlerModule
For "contentHandler1" to be sxrSAXReader's content handler, we have to Set it to sxrTransitionReader.contentHandler as below:
Set sxrSAXReader.contentHandler = contentHandler1
Now we can parse an XML Document contained in an XMLDOMDocument object with the "parse" method of the SAX Reader:
SAXReader.parse XMLDocument
But what about that Class Module that becomes the content handler? It is a regular Visual Basic Class Module, and it contains the following lines of code at the very beginning:
Option Explicit
Implements IVBSAXContentHandler
This code tells us that this Class Module is going to implement a SAX Reader's contentHandler. This means that it is going to contain a bunch of functions that are actually called as events when the SAX Reader is parsing the XML Document. All o
f these "event" functions have to be declared, even if you don't use them (otherwise it will give error). The following represents the list of all the event functions:
IVBSAXContentHandler_characters()
IVBSAXContentHandler_documentLocator()
IVBSAXContentHandler_endDocument()
IVBSAXContentHandler_endElement()
IVBSAXContentHandler_endPrefixMapping()
IVBSAXContentHandler_ignorableWhitespace()
IVBSAXContentHandler_processingInstruction()
IVBSAXContentHandler_skippedEntity()
IVBSAXContentHandler_startDocument()
IVBSAXContentHandler_startElement()
IVBSAXContentHandler_startPrefixMapping()
Even though you have to have them all present in the Class Module, you usually will only use these common ones:
IVBSAXContentHandler_startElement(strNamespaceURI As String, strLocalName As String, _
strQName As String, ByVal oAttributes As MSXML2.IVBSAXAttributes)
IVBSAXContentHandler_characters(strChars As String)
IVBSAXContentHandler_endElement(strNamespaceURI As String, strLocalName As String, strQName As String)
Let's go over each one individually, the first is the "IVBSAXContentHandler_startElement" or the start element event. It is called when we arrive at a begining or starting XML element tag (like "" or ""). Obviously then, t
he "IVBSAXContentHandler_endElement" event is called when we hit an ending tag (like "" or ""). The "IVBSAXContentHandler_characters" event represents when we arrive at the contents of any given node, the inline contents. So to s
ee th
is in action let's provide an example XML Document snippet:
I'm going to turn Green.
When the SAX Reader parses this document it comes to the start of the "response" node and fires off the "_startElement" event. In the following example, when we arrive at the starting transition node tag "", the message box
would present the contents of strLocalName, which would be "response", without the quotes of course:
Private Sub IVBSAXContentHandler_startElement(strNamespaceURI As String, strLocalName As String, _
strQName As String, ByVal oAttributes As MSXML2.IVBSAXAttributes)
MessageBox "This is the " + strLocalName + " node's starting element tag."
End Sub
When we came to the ending transition node tag ("") the endElement event is fired off, and when we come to the inline content of the node, the "IVBSAXContentHandler_characters()" event gets fired and when it does, the value for it's
strChars parameter is the inline content "I'm going to turn Green.". Using a SAX Reader to parse an XML Document, especially a big one is many times faster than using For...Next loops in VB, and is the primary reason we use SAX Readers in this project.
XPath Syntax
XPath syntax is the process of submitting an XML style "query" string to select nodes out of an XML Document. The results of the query can then be stored in a XMLDOMNode or a XMLDOMNodeList object depending on whether we use the selectNode or s
electNodes method of the DOMDocument object. To demonstrate lets suppose we have a XML DOM Document as represented below:
*RUN SCRIPT*
I'm going to turn Green.
A sampling of XPath syntax against the above document is provided below:
XMLDOMDocument.selectNodes("transitions/transition[@ID='180']/responses/response[@gender='' or @gender='M']")
This XPath selectNodes() statement selects the node in the above document (ID='180'), and grabs all "response" nodes in the "responses" node that have a "gender" attribute equal to '' or 'M'.
XML Document Comment Block
A document can contain "comment blocks" that serve to help document the XML document inline. This can provide for better organization of the document. Below is a sample:
String Manipulation Functions
The following gives a briefing and examples of some of the string manipulation functions provided by Visual Basic 6.0 that enable us to do string manipulation in the project. The Replace() function is available only through VB 6.0. The Split()
and Join() are VB 5.0 and up. It is possible to write the code in VB 5.0 providing you write your own Replace() function using Split() and Join(). So, without further ado, here are the major string manipulation functions used in this project:
Like operator
The Like Operator is used to compare two strings. It is the way we compare the user's input against the templates in the bot's brains.
Syntax:
result = string Like pattern
This example uses the Like operator to compare a string to a pattern.
Dim MyCheck
MyCheck = "aBBBa" Like "a*a" ' Returns True.
MyCheck = "F" Like "[A-Z]" ' Returns True.
MyCheck = "F" Like "[!A-Z]" ' Returns False.
MyCheck = "a2a" Like "a#a" ' Returns True.
MyCheck = "aM5b" Like "a[L-P]#[!c-e]" ' Returns True.
MyCheck = "BAT123khg" Like "B?T*" ' Returns True.
MyCheck = "CAT123khg" Like "B?T*" ' Returns False.
InStr()
Returns the position of the first occurrence of one string within another.
Syntax:
InStr([Start, ]string1, string2[, compare])
Replace()
Returns a string in which a specified substring has been replaced with another substring a specified number of times.
Syntax:
Replace(expression, find, replacewith[, start[, count[, compare]]])
Split()
Returns a zero-based, one-dimensional array containing a specified number of substrings.
Syntax:
Split(expression[, delimiter[, count[, compare]]])
Join()
Returns a string created by joining a number of substrings contained in anarray.
Syntax:
Join(list[, delimiter])
Trim() - Removes white space from both ends of this string.
Len() - Returns the number of characters in a string or the number of bytes required to store a variable.
Mid() - Returns a specified number of characters from a string.
UCase() - Returns a String containing the specified string, converted to uppercase.
LCase() - Returns a String containing the specified string, converted to lowercase.
Processes for loading the bots into the system:
XML DOM node and nodelist variables are declared to retrieve the values for the bot's global variables listed below:
strAgent, strBotName, strBotGender, strMoveTo, lngtoID, strResponse
And the bot's XML data files in DOMDocuments are declared as well:
xmlTransitionDocument(), xmlWordGroupDocument, xmlPersonalityDocument
xmlAnimationDocument, xmlPronounDocument, xmlBlackboardDocument
First we load the XML botfile into xmlBotDocument.
Then we:
select the bots starting transition from the botfile
select the bots starting response
select the bots brainfiles (the return is a nodelist here)
select the MSAgent Filename for the bots Agent
select the bots personality document
select the bots wordgroup document
select the bots pronoun document
select the bots blackboard document
select the bots Agent animation translation file document
select the scripting engines language
select the bots name value
select the bots gender value
select the bots starting position value
Now we load XML files into Document Objects.
load the XML brainfiles
load the wordgroup document
load the bots personality document
load the pronouns
load the blackboard
load the animation translator
set the agents file
set the bots name
set the bots gender
set the bots initial position
initialize the starting transition
initialize bots opening statement
reset script engine
set script engines language
extend the application with objects
initialize strUserName
init dimension of UserProfile()
And that's all there is to loading the bot from the botfile.
Processes for responding to a user's chatter while using the system:
Below is the VB Subroutine that sets the response variables for the agent to play in response to the user's input.
Public Sub ChatbotResponse(strInput As String)
When this subroutine is called, the user's string input is passed to this subroutine. There are five string variables that we have to fill for the bot to deliver it's response. These global variables are declared in Main.bas:
strResponse - This is the string that contains what the bot says. It is passed to the MSAgent or TTS Engine.
strAnimation - This string contains the animation that we send to the MSAgent.
strSourceFile - This string contains the App.Path\Path\Source Filename of the script node's src attribute. It is loaded into the Script Engine and executed.
strScript - This string contains the inline string of the script node of the response.
strMoveTo - This string contains one of nine regions of the screen:
TL - Top Left
TC - Top Center
TR - Top Right
CL - Center Left
CC - Center Center
CR - Center Right
BL - Bottom Left
BC - Bottom Center
BR - Bottom Right
Now we look at the processes to handle the users input in ChatbotResponse():
1. Declare and initialize variables
SAXReaders and their contentHandlers, response nodes, script node and animation attribute values container variables.
Initialize script engine variables.
2. Prepare user input as strUserInput AND strUserInput2 AND strUserInput3
Initialize internal blackboard with the bot's name.
Form user input by trimming spaces in front and end.
Form user input by stripping out punctuation.
Form user input by stripping out excess spaces.
Assign last user input to strLastUserInput, a variable that holds the user's last input
Form user input by converting to uppercase.
Parse through word groups SAX Reader's content handler.
Form user input by stripping out excess spaces.
Get strUserInput3 here. The variable strUserInput3 has NO number, date, pronoun etc. tags
Run user input through internal blackboard items, if a number, date, pronoun etc. then add to InternalBlackboard() through InternalBlackboardAdd().
Replace occurences of bot's name with ~BOTNAME.
Replace occurences of user's name with ~USERNAME.
Check for blackboard xml file items, if found then replace in strUserInput and add to InternalBlackboard().
Get strUserInput2 here, strUserInput2 has number and date and blackboard tags but NOT pronouns
Run strInput through pronouns xml file, if word is a pronoun then add all of the different forms for that pronoun to the blackboard.
Form user input by stripping out excess spaces again just in case any excess spaces remain.
Get strUserInput here, strUserInput has all tags, number and date and blackboard and pronoun tags.
3. Parse transitions using SAX Readers
Begin to parse transition documents, looking for the highest ranking template that Like compares with strUserInput or strUserInput2 or strUserInput3 and has a fromID attribute = lngLasttoID
If last toID > 0 then handle transition.
If not found proceed with other brainfiles with last toID equal to 0 (a root transition).
Go through and parse all brainfiles this way in all brainfiles loaded in xmlTransitionDocument().
4. Retrieve and process response, script and animation data contained in the selected transitions
Get responses by gender = '' or equal to bot's gender value from it's botfile.
Randomly select one response.
Get toID, animation, moveto attributes of selected response node.
5. Build internal blackboard
Make call to BuildInternalBlackboard().
InternalBlackboard() is initialized in ChatbotResponse() with ~BOTNAME in InitInternalBlackboard(), now we must add ~ASTERICKs, system date and time, and last user input.
Get ~ASTERICK(1..n) from strUserInput or strUserInput2 or strUserInput3, which ever one was used and add to InternalBlackboard() if there is an asterick in strtemplatetext, replace the I YOU words.
6. Process script data
We execute script here in case it needs to do something with strResponse.
Get src attribute of script tag and send to Script Engine to be executed.
Get inline script of selected transition and send to Script Engine to be executed.
Reset script engine.
Set script engines language.
Extend the Script Engine with application objects.
7. Process response data
Implement VORT through BuildResponse(), see the "Using VORT in the Response Node" section later on in this paper.
Pass strResponse through XML Personality Doc.
Run strResponse through internal blackboard.
Run strResponse through internal blackboard a second time to account for lower case ~pronoun1, ~date1 or other tags in the ~ASTERICK1 element.
Run strResponse through user profile.
Run strResponse through user profile a second time to account for lower case ~username or other tags in the ~ASTERICK1 element.
Capitalize the first letter of the sentence in strResponse.
8. Deliver Response
Send strResponse to the MSAgent or TTS Engine to be spoken
Send strAnimationto the MSAgent as the animation to play
Send strMoveTo to MoveAgentTo() in frmMain, this string contains one of nine regions of the screen to move the Agent to:
TL - Top Left
TC - Top Center
TR - Top Right
CL - Center Left
CC - Center Center
CR - Center Right
BL - Bottom Left
BC - Bottom Center
BR - Bottom Right
The bot's VB project files:
Forms Used:
frmMain.frm
frmScriptExtender.frm
Modules:
Main.bas - This contains the majority of the code for implementing the ArchBot project.
Class Modules Used:
PersonalityParser.cls
TransitionParser.cls
WordGroupParser.cls
AnimateTranslateParser.cls
Bot Engine Functions found in Main.bas
Chatbot Functions:
LoadBot(filename As String)
ChatbotResponse(strInput As String)
Pre-Formatting Functions:
StripPunctuation(strInput As String)
StripSpaces(strInput As String)
ParseAtomtypes(strInput As String) As String
Script Engine Functions
ExtendScriptEngine()
ExecuteScript(strScript As String)
ExecuteSource(strSource As String)
Internal Blackboard Functions
InitInternalBlackboard()
BuildInternalBlackboard()
InternalBlackboardParse(strResponse As String) As String
UserProfileParse(strResponse As String) As String
InternalBlackboardAdd(strItemname As String, strItemtext As String)
XML Document Loading Functions:
LoadTransitions()
LoadWordGroups(filename As String)
LoadPersonality(filename As String)
LoadAnimationTranslator(filename As String)
LoadPronouns(filename As String)
LoadBlackboard(filename As String)
VORT Functions:
SelectOPTIONSegment(strRespTemplate As String) As String
SelectORSegment(strRespTemplate As String) As String
BuildResponse(strRespTemplate As String) As String
Building a Bot
Bot File Structure
XML NLP\ArchBot.exe
This is the main executable.
XML NLP\Bot Data
This is where files for wordgroups, pronouns, blackboard and animation translation files for all bot's are stored.
XML NLP\Bots
This is where the different bot files are stored.
XML NLP\Brainfiles
This is where the bot's brainfiles are stored.
XML NLP\Docs
This is where all the documentation for the project is found.
XML NLP\Personalities
This is where personalities for all the bot's are stored.
XML NLP\Scripts
This is where script files for all bots are stored.
Bot Files
The bot file
A bot is defined by it's bot file. The bot file is an XML Document with elements that are other XML files that help build the bot. Files such as an animation translation file for the MSAgent, a wordgroup file, a personality file, a pronoun file
, a blackboard file, an agent file, the script engine language, the bot's gender, the starting transition, the starting response, the starting position, and transition files or "brain files" are defined in the botfile. This allows us to build bots with
diffe
rent Agents, personalities, different startup transitions, position and responses as well as a different gender and different transition or brain files. You can also set which language the bot's scripts are written in. Later on you will learn what these
various files do, and how they build a bot. Below is the botfile's XML Document spec.
The agentfile Node
The agent file node contains the file of the MSAgent used for this bot.
The scriptlanguage Node
The script language node sets the script language used for this bot.
The botgender Node
The bot gender node sets this bot's gender.
The starttransition Node
The start transition node sets the value used to determine the first transitions examined by the bot on the first input. It is always found in the first brainfile listed in the botfile.
The startresponse Node
The start response node allows us to set the first thing this bot says (the bot talks first).
The startposition Node
The start position node allows us to set where the MSAgent is first positioned on the screen.
The animatetranslate file Node
The animate translate file is the first file node in the botfile and it's file serves to "translate" the bot's animations that are embedded in every response to animations that are supported in the Agent software. This is done so that an Agent
that doesn't have the same animations as the bot can still be used as an Agent for the bot by simply translating bot animation names for animations the Agent does have. If an Agent doesn't have the "Angry" animation then we replace it with one it does h
ave l
ike "Sad" for example. You must have all bot animations listed along with their agent translations in this file.
Below is the Listing of the animations of this bot architecture:
Bot Animations - 90 in all
----------------------------------
* - Speaking frames - 50 in all
Acknowledge
*Alert
*Angry
*Announce
*Arrogant
BiteLip
Blink
*Blow
*CloseEyes
*CloseEyesTight
*CrossEyes
*Confused
*Congratulate
*Coy
*Crazy
Decline
*DontRecognize
*EvilFace
*Explain
EyeWinkLeft
EyeWinkRight
FlareNostrils
*GestureDown
*GestureLeft
*GestureRight
*GestureUp
GetAttention
GetAttentionContinued
GetAttentionReturn
*Greet
Hearing1
Hearing2
Hide
*Hurt
Idle1_1 - Blink, LookUp, LookDown, LookLeft, LookRight
Idle1_2 - Sniff, Blow, Sigh, Squint, CrossEyes
Idle2_1 - Talk to Self, Mutter
Idle2_2 - Whistle
Idle3_1 - Yawn
Idle3_2 - Yawn,Sleep
*Impatient
Kiss
*Laugh
*Listless
*LookDown
*LookLeft
*LookRight
*LookUp
MoveDown
MoveLeft
MoveRight
MoveUp
*Paranoid
*Philisophical
*Pleased
*Pout
Process
Processing
*Proud
PuffCheeks
*RaiseEyebrows
*Relieved
RestPose
RollEyesInDisgust
RollTongueInMouth
*Sad
*Sarcastic
*Scared
Search
Searching
*Shout
Show
*Sick
*Sing
SmileLipsClosed
SmileShowTeeth
*Smug
*Sneer
Sniff
*Snub
*Squint
StartListening
StickOutTongue
StopListening
*Suggest
*Surprised
Think
*Tightlipped
*Uncertain
*Weird
Below is the animate translate file's XML Document spec.
The wordgroup file Node
The wordgroup file is used to replace words in the user's input with replacement word or words. Contractions like DONT and DON'T become DO NOT. Words that mean the same like HI, HEY and HOWDY can be reduced to HELLO. YEP, YEA and YEAH become YE
S. Common mispellings, word numbers and many other uses for this listing allow the bot author to symbolically reduce the brainfile or transition nodes that contain the templates used to compare to the user's input. Below is the word group file's XML Doc
ument
spec.
The personality file Node
The personality file is used to replace words in the bot's responses with personal information about the bot like the bot's Name, Birthday or Gender for example. Below is the personality file's XML Document spec.
The pronoun file Node
Sentences that use pronouns can be symbolicaly reduced and have pronouns correctly conjugated in the bot's response. The pronouns I and YOU are correctly switched. The tags ~SUBPRON, ~OBJPRON, ~SUBPOSSPRON, ~OBJPOSSPRON, ~COMPPRON are placed in
the Blackboard system and can be swapped out in the bot's response.
The blackboard file Node
The blackboard file is used to replace words in the user's input with groupings similar to wordgroups, and it also adds the item's name and itemtext to the InternalBlackboard().
The transition file Node
The transition file serves as the bot's brain, and a bot can have more than one transition file. The last transition that was used sets the last toID variable with it's toID attribute. All transitions with a fromID equal to the last toID value
are examined, and the transition with the highest ranking "template" matching the user's input is selected. The transition's responses, animation and script are then obtained to be used as the bot's response, animation and script. Animation attributes c
an on
ly have the official underlying bot animation set as valid values. You can also set the 'moveto' attribute to values 'TL','TC','TR', 'CL','CC','CR','BL','BC' and 'BR'. Responses can branch to transitions other than the transitions toID through their own
toID attribute. Responses are also gender specific, using values of 'M', 'F' and '' through the gender attribute. Script tags can have a script's source file defined by the 'src' attribute. They can also have script between the script tags. The attribu
tes i
So the "smallest" transition would look like the following:
And the following is an example set of transition nodes that allow us to turn off the system:
GOODBYE
Do you want to say goodbye and exit?
YES
Goodbye!Later!
NO
Glad to see your staying!
In the source, "commands.vbs", I might have a subroutine called GoodBye(), like below:
Sub GoodBye()
' this executes the Public Sub GoodBye() in the System object.
System.GoodBye
End Sub
Below is a sample botfile, "Genie", that is male, with a personality file called "genie.xml", an MSAgent file "Genie.acs", supports the VBScript script language, and starts off coming from a transition with a fromID = 170. The bot "Genie", star
ts off asking the user, "Please type your name below.", and the MSAgent is centered in the middle of the screen:
BotData\animations.xmlBotData\wordgroups.xmlPersonalities\genie.xmlBotData\pronouns.xmlBotData\blackboard.xmlGenie.acsVBScriptGenieM170Please type your name below.CCBrainfiles\vbsbrainfile.xmlBrainfiles\basebrain.xmlBrainfiles\RPSGame.xmlBrainfiles\eliza.xmlBrainfiles\jokes.xmlBrainfiles\personality.xml
Building a Bot's Brains
The Transition Node
The ID attribute
The ID attribute of the transition node of the transitions document is used to be able to obtain the transition node if it is selected by the bot. If one of a transition's templates Like compares to the user's input and it is selected then w
e get the ID attributes's value and later we can obtain the information that the transition contains. ID's must be unique within a single transition document but ID's of the same value can be placed in other seperate transition files.
The toID attribute
The toID attribute tells us where this transition node is going to transition to, hence the term "toID". If the transition is selected and the toID equals "21" lets say, then next time we Like compare all the transitions in a bot's brain, th
ey must have a "fromID" equal to "21". The transition's toID can be overwritten by a toID in one of the transition's responses.
The fromID attribute
The fromID attribute tells us where this transition transitioned from, hence the name "fromID". If the last toID was equal to "21" then and this transition's fromID = "21", then this transition will be selected to have it's templates Like co
mpared to the user's input.
The Template Node
The rank attribute
The rank attribute of the template node is used to rank templates so that when the bot is Like Comparing the user's input against all the templates, the template that is Like the user's input that has the highest rank is the one choosen. Thi
s is so that the bot selects the more important template over lesser important ones. Example, if the user types "I like you" and the bot has two templates that match: "*" and "I LIKE *", then the "I LIKE *" template is going to be selected because it wo
uld h
ave a higher rank (2 versus 0 in this case). The rule in assigning ranks is usually to count the number of words and tags and don't count astericks that are in the template. For example, the template "I * LIKE YOU TO *" would be assigned a rank of 4.
The inline text in the Template node
The inline contents of the template node provide the strings that are Like compared to the user's input. They can contain words(in UPPERCASE), Tags, anything that can constitute a template.
The Response Node
The gender attribute
The gender attribute allows us to give a transition responses that are gender specific. The codes for the gender attribute are "M" for male, "F" for female and "" for a nongender specific response. When the bot selectes a transition and look
s at all of it's responses, it first gathers all the responses with genders equal to the bot's gender, and also all of the responses with "" or nongender specific. The bot then randomly selects a response from this list.
The animation attribute
The animation attribute lets a response have an animation for the bot's MSAgent to play before it speaks the response.
The moveto attribute
The moveto attribute lets us give a response node a position on the screen for the bot's MSAgent to move to before it plays it's animation and speech. There are nine regions of the screen that the agent can move to (supports any screen resol
ution). The values for the moveto attribute are:
TL - Top Left
TC - Top Center
TR - Top Right
CL - Center Left
CC - Center Center
CR - Center Right
BL - Bottom Left
BC - Bottom Center
BR - Bottom Right
The toID attribute
The toID attribute tells us where this responses transition node is going to transition to, hence the term "toID". If the transition is selected and the toID of the response equals "21", then next time we Like compare all the transitions in
a bot's brain, they must have a "fromID" equal to "21". The transition's toID can be overwritten by this response's toID.
The inline text in the Response node
The inline text in the Response node tells us what this bot will say in response to the template of the transition, which is what the user last said. Any textual response can be provided here and can contain Tags as well as using VORT syntax
.
The Script Node
The src attribute
The src attribute of the Script node contains the file name of the source of this script nodes code. For example: 'Scripts\userprofile.vbs' is a VBScript file within the bot's Scripts folder.
The inline text in the Script node
The inline text in the Script node is script code in the script engine language of the bot. For example, you can have a script file with a DoSomething() Function defined in the source code, and the actual call of the function in the inline t
ext.
Three User Input translations
When a user inputs an utterance or sentence into the system, it is usually taken and parsed so that it is in all uppercase, it has no punctuation, and all words in it have only one space between them. Now we can swap out certain words for tags or
maybe we don't. As you will see, we build three versions of the user's input to Like compare to templates in the bot's transition files. Here are these three alternatives and what they contain:
strUserInput - No tags
strUserInput2 - All tags except for Pronoun tags
strUserInput3 - All tags
So why three versions? We wish to have the flexibility of not having to use tags for special cases. For example, If I don't want to tag anything, because I don't want to tag numbers, then I can do so:
DID YOU SEE 2001 A SPACE *
Here, I wish to know the number and the pronoun so that I'm sure the user is saying "Did YOU see 2001...". This template is more specific than tagged templates, and sometimes it is useful and flexible to have this ability.
Tags used in this system
Below is a listing of the tags that are used in user input templates (see above) and also used in the bot's response. In the user's input, when we encounter a word that is listed in one of these lists, we replace it with one of these tags and we n
umber the tag, then we place the word and it's tag in the "blackboard" system. If we encounter any tags in the bot's response, we look it up in the "blackboard" and replace with the items value. Below is a listing of the tags that are used in this syste
m:
Pronouns
~PRONOUN
~SUBPRON
~OBJPRON
~SUBPOSSPRON
~OBJPOSSPRON
~COMPPRON
Blackboard
~COLOR
~WEEKDAY
Internal Blackboard
~ASTERICK
~BOTNAME
~NUMBER
~DATE
~DATE[N]_1
~DATE[N]_2
~DATE[N]_3
~DATE[N]_4
~DATE0_1
~DATE0_2
~DATE0_3
~TIME0_1
~TIME0_2
~LASTUSERINPUT
User Profile
~USERNAME
~USERAGE
Personality
~BOTNATIONALITY
~BOTFAVORITECOLOR
~BOTFAVORITEDRINK
~BOTFAVORITEMUSIC
etc.
If we studied further, we would see the need to eventually, symbolically reduce all of the following:
Numbers - 1, 2, 3.5, 8,900,567
Word Numbers - One, Two, Twenty five
Ordinal Word Numbers - First, Second, Third
Dates - 06/29/2002
Word Dates - Saturday, June 29, 2002
Currency - $14.56
Word Currency - four dollars
Time - 3:00 PM, 4 oclock, 8 AM
Word Time - five oclock in the afternoon, seven in the morning
Username - Greg
Botname - Eliza
Contractions - don't, dont, can't, i'd, i'll, y'all
Common synonyms ie. Hello, Hi, Hey or No, Nay, Nope or Yes, Yeah, Yep
Computer data types ie. Urls, E-Mail Address
Pronouns - I, You, He, She, It, They, We, You all
Prepositions - on, in, above, top
Conjunctions - and, if...then, because, or
Interjections - Ah!,Alas!,Oh!,Ouch!
Other common words - articles (a,an,the), colors (red,blue,green), billions of other examples!
If we symbolically reduced words in these categories, we can achieve a lesser need to store what is essentially, needless repetition. I only did pronouns, dates, numbers and a few others in this project, but you could certainly expand it to be abl
e to handle more tags.
Using VORT in the Response Node
VORT - Variable Output Response Template, is the system of using braces, brackets and pipes to give the bots response more variation.
VORT Tags:
| - OR is the pipe character.
[] - OR brackets enclose OR structures.
{} - OPTIONAL brackets randomly select chance of segment
being in the response.
VORT RULES:
OPTIONAL brackets can be nested inside other OPTIONAL brackets.
OR brackets can be nested inside OPTIONAL brackets.
OPTIONAL brackets can be nested inside OR brackets.
OR brackets CANNOT be nested inside other OR brackets.
IMPORTANT NOTE:
If Incorrect Syntax with {} or [] brackets then message output is: ERROR - INVALID SYNTAX. Engine cannot identify all possible errors yet.
Example of INCORRECT made template:
[Hi|[Hello|Hallo]|Hey]{ there}{ ~USERNAME}{, how {are you}.
* * *
In the above example, the "[Hello|Hallo]" OR segment is inside the "[Hi|...|Hey]" OR segment but OR brackets CANNOT be nested inside other OR brackets. Also the OPTIONAL segment at the end of the sentence "{, how {are you}." does not have the clos
ing brace "}".
Examples of CORRECTLY made VORT Templates:
1. {[The t|T]ime[ is|:] }11:00{ PM}{, Saturday}{, July{ 14,2001}}.
2. [Hi|Hello|Hey]{ there}{ ~USERNAME}{, how are you}.
Example 1. can yield 60 different variations.
Example 2. above can yield any of these 24 possibilities:
Hi.
Hello.
Hey.
Hi there.
Hello there.
Hey there.
Hi ~USERNAME.
Hello ~USERNAME.
Hey ~USERNAME.
Hi there ~USERNAME.
Hello there ~USERNAME.
Hey there ~USERNAME.
Hi, how are you.
Hello, how are you.
Hey, how are you.
Hi there, how are you.
Hello there, how are you.
Hey there, how are you.
Hi ~USERNAME, how are you.
Hello ~USERNAME, how are you.
Hey ~USERNAME, how are you.
Hi there ~USERNAME, how are you.
Hello there ~USERNAME, how are you.
Hey there ~USERNAME, how are you.
~USERNAME would be replaced with users name. Notice punctuation is a period instead of a question mark for the question. Having templates with OPTIONAL bracketing and OR braces means many more possibilities can be stored in a smaller space. Replac
ing the tag symbols can deliver the users name, dates, peoples names, and other items from the blackboard. We can also randomly slow and speed the output, insert a "\emp\" tag or others in the main pieces of the output, etc. This can enrich the otherwis
e bla
nd sounding output that comes from the TTS engine, but this should be used sparingly, only 5-10% of the time.
Here are the VB Code Functions that implement VORT:
SelectOPTIONSegment(strRespTemplate As String) As String
SelectORSegment(strRespTemplate As String) As String
BuildResponse(strRespTemplate As String) As String
To make the call in VB code you pass a VORT sentence string into BuildResponse():
Dim strResponse As String
strResponse = BuildResponse("[Hi|Hello|Hey]{ there}{ ~USERNAME}{, how are you}.")
MsgBox strResponse
Extending the App and Scripting a Bot
One of the big things I have seen missing in alot of chatterbot engines and software is the ability to have the bot DO something. Sending E-Mail, opening applications, browsing the Internet, displaying control panel applets, the ability to "turn i
tself off" or close the bot application. All of these abilities exist in the ability to program the computer to do them all, and this project lets the user call these abilities to task when needed in the "Script Node" of the bot's transition files. When
a tr
ansition is "hit", we execute the script it contains in the Windows Script Host, a scripting engine for Windows, that allow us to execute VBScript or JScript. We can also "extend" our application by adding controls and objects to the scripting engine. F
or example, below is an example of adding the main bot application interface to the script engine:
frmMain.sptScriptEngine.addObject "UserInterface", frmMain
So I can now script my bot to change the interface through script like so:
*RUN SCRIPT*
I'm going to turn Green.
In the source, "test.vbs" I have a subroutine called TurnGreen(), here is the code listing:
Sub TurnGreen()
' this tests the src attribute of the script tag
Msgbox "I'm going to turn Green."
UserInterface.BackColor = vbGreen
End Sub
So whenever the user says "run script", the script engine loads the Sub TurnGreen() from the source and then makes the call through inline script ().
This "Script Node" allows us to script each transition with little programs written in VBScript or JScript. This gives us the ability to have our bot DO something for us.
Script Engine Functions:
ExtendScriptEngine() - this function resets the script engine, assigns it the script language from the botfile, and extends the script engine with controls, see the "Script Extensions in this project" to see what is added in this project.
ExecuteScript(strScript As String) - this function takes inline code, that is code in between the script node tags, and executes it AFTER loading any code sourced in.
ExecuteSource(strSource As String) - this function looks at the "src" attribute of the script node and loads the script file into a RichTextbox Control. We then pass this "text" to the script engine to be executed BEFORE any inline code.
Script Extensions in this project
It is in the ExtendScriptEngine() function, that we extend the bot application. Here are the extensions used in this project:
"UserInterface" frmMain
"System" frmScriptExtender
frmScriptExtender Functions:
Public Sub Goodbye() - this function is executed to "turn off" or close the bot application.
Public Function GetBlackboard(strBlackboardItem As String) As String - this function can retrieve an item from the "blackboard".
Public Sub SetBotResponse(strBotResponse As String) - this function can change the bot's strResponse value. It essentially gives us the ability to control the bot's response through script.
Public Sub SetUserName(strInputName As String) - this function is used to get the users name from the users input.
Public Sub SetUserProfile(strInputName As String, strInputText As String) - this function adds an item and it's value to the UserProfile() list.
The Four Laws of Chatterbots - by Dr. Walter Alden Tackett, president of Neuromedia Inc.
First Law: A bot will always respond to input. Failure to respond should solely be an indication of hardware/software/connectivity failure.
Second Law: A bot will always be knowledgeable in the subjects it mentions in its answers, e.g., when a bot says, "Our widget works well with fish", the bot should be able to answer questions about fish and their relation to the widget.
Third Law: A bot will not repeat itself unduly (also, a bot will not repeat itself unduly). Any response which is likely to be elicited several times in a single conversation should be represented by multiple phrasings that are chosen at random. T
his is particulary helpful when the bot is stumped by an input. (See Fourth Law).
Fourth Law: A bot will offer guidance when stumped. When presented with inputs that are not "understood", a bot should offer clues as to the inputs it can respond to authoritatively.
Brainfile Overwriting - The concept of "overwriting" is simple. When there are two transitions that have the same templates, one can "overwrite" the other by the "overwriting" transition occurring after the "overwrote" transition. Usually, overwrites
occur in a seperate brainfile that is placed last in the brainfiles list in the botfile. The example below is such an example:
...
Brainfiles\vbsbrainfile.xmlBrainfiles\basebrain.xmlBrainfiles\RPSGame.xmlBrainfiles\personality.xml
...
Brainfiles\genieoverwrites.xml
Future Versions
The project could certainly be enhanced ten fold by turning it into an ActiveX control that computes all the NLP chores and works side by side with other ActiveX controls that form a VB or C++ windows app, web page interface, or any type of interface
that utilizes ActiveX technologies. The code for transition XML Document parsing could be made more efficient and fast, actually this is really all you need to do because everything else is pretty fast. Other parts could probably be modularized more, e
speci
ally the main function ChatbotResponse(). Fully extending the Bot application in the Script engine as well as adding application stuff like word processor, reminder system, Web browser and system control like Windows Shutdown, Control panel applets, and
adding stories, quotes, games etc. The purpose of the bot is to provide system control as well as a chat partner.
About Me
My name is Greg Binning and I have spent 2 years putting this project together in my spare time. I work for state government in Louisiana as a Systems Analyst 2, currently I'm working on a special project to build a statewide web based application an
d I serve as that project's Technical Manager. I have studied Artificial Intelligence for many years now and this project is one product of that study. I am as of now, finished with this project and now involved in an expanded artificial intelligence pr
oject
using Visual Basic 6.0 as the choice development language. This enhanced version will be open source as well.