Development
of the Chatterbot
Introduction
The aim of our group project was to design and prototype a
Chatterbot. A Chatterbot converses in natural language (in this
case, English) and responds to input from the user, with a
grammatically correct sentence.
Having carried out extensive research into this particular
area of AI, it soon became obvious that we would have to narrow
our scope, due to the time constraint. Many of the existing
Chatterbots that have competed in the Turing prize have spent
more than four years being developed.
For this reason, we decided to develop a program that showed
how the Chatterbot�s �brain� functions by parsing
a few syntactically allowable sentences. It will hopefully show
that the program is truly extensible, allowing every
syntactically allowable sentence to be added.
�
How the
Chatterbot was Designed
The Chatterbot will be implemented as a C++ program with
several different modules for dealing with the various types of
input from the user.
�
- Kbase.dat � This is the knowledge base
module. If a keyword is found in the input sentence, the
response will be randomly selected from a choice of
responses for that particular keyword. This allows the
Chatterbot to talk on a subject with precision. This is
very similar to the way a human may parse common phrases
such as, "Hello" or "What is your
name?" Their response will nearly always be
instinctive, requiring little or no grammar parsing. This
is the reason why when asked the question "Do you
know the time?" most people would reply with
"Yes it�s ten past twelve" as opposed to
"Yes thank you". The knowledge base is
extensible.
�
- Kbase.tpl � This contains the
templates for the generic answers based on the
user�s question. The input sentence is parsed and
the response is placed within the template.
�
As the Chatterbot is designed to converse on a particular
subject of our choice, we decided that the input sentence should
be matched with the keyword database first. The keywords are
given the highest priority. Common phrases such as
"Hello" and "What is your name" are also
stored here.
This is known as a "slot and frame" parser. However,
it is quite sophisticated. The input string is first
"cleaned". This strips the sentence of any punctuation
to allow the user to enter question marks, exclamation marks etc.
The sentence is converted to lowercase by the function tolower().
This again allows the user to input a sentence using upper or
lower case, or both. The number of keywords is quite small, but
can be extended to the extent of the computer�s available
memory.
The parser is flexible. As a result, phrases such as "I
like Al Pacino" and "Tell me about Al Pacino"
generate a sensible response.
It is important to note, the slot and frame parser does not
allow the program to understand what is being said. Rather it
simply makes automated responses to keywords. The sequence for
matching a keyword is as follows:

|