General
Overview of Program Functions
The program �Arthur� that we have created in C++ is
a trial program for a fully functional �Chatterbot�.
The core of the program has been successfully modelled and is
fully extensible.
The program has four distinct components: - The Header file,
the Database, the Template file and the program itself. The
program is also divided into six functions: - main(), parse(),
response(), search_database(), display() and templ_database(). An
overview of each of these functions and components will be given
with individually.
The input from the keyboard is read into an array using the
empty spaces between the strings as separators. The sentence is
assembled from this array of strings. At this point, the sentence
is sent to a function in the header file (See header file
definition) where it is cleaned of punctuation and converted into
lower case. Each string is now a word.
Before any parsing is done to the sentence it is now possible
to look through the database to see if there is a match between
any topics, in the form of key words or phrases and the input
sentence (See Database definition). If a match is found, one of a
number of possible replies can be generated. If no match is found
in the database, the sentence is passed to the parse function
where it is analysed in order to create a response.
In the Parse function (See Parse function definition) the
input sentence can now be read as a bit stream pattern. The
header file contains a lexicon of known words including, verbs,
nouns, adjectives and interrogatives etc. The pattern uses
integer values to identify the input words as belonging to one of
the different word groups. It does this by comparing each input
word with the lexicon in the header file.
The patterns are then used to see if a sentence is acceptable
to the rules of the program. In our program, we have elected to
define two patterns as being acceptable in order to demonstrate
the �Chatterbot�. In future versions, any number of bit
stream patterns could be used. Each pattern, defined as being
grammatically correct, by the program, requires additional code
to deal with the structure of the response. The response is
generated in the Response function (See Response Function
Definition).
The response to the input pattern is generated by the rewrite
rules within the program. The rules attempt to deal with all of
the verb tenses and the grammar needed to respond to the input
sentence. The response generated is then passed to the template
file. The template file consists of a number of possible phrases
within which to place the response (See Template definition). A
template is selected at random to house the response. There is no
reason to limit the number of choices possible for a match to a
particular response type.

|