Using the Pop-11 matcher to implement a simple chatbot

Using the Pop-11 matcher to implement a simple chatbot

A chatbot is a program that is capable of holding a conversation
with a user, which may use text or spoken language. Many Chatbots
are very boring because they are very limited in what they can
respond to and what they can say in response. A chatbot usually does
not understand anything that they user types in or that the chatbot
types in response. However, it is possible to have a chatbot that
understands a little about a small subset of the world and can talk
about that.

However, most chatbots depend on the programmer anticipating the
sorts of things that could be typed in and preparing suitable
responses. In some cases the response could be based on some of the
words actually typed in, giving the illusion that the chatbot
understood what it read in. An example chatbot that can use patterns
to work out how to respond is the Pop-11 Eliza, which anyone can
interact with on the internet:

http://www.cs.bham.ac.uk/research/projects/cogaff/eliza/

An example of an architecture for a chatbot:


We can represent the architecture diagrammatically:

  *------*  --- > ---  *---------*  --- > ---  *----------------*
  | USER |             |INTERFACE|             |INFERENCE ENGINE|
  *------*  --- < ---  *---------*  --- < ---  *----------------*

The interface as a sub-program which prints out a greeting, then
repeatedly reads in a sentence and prints out a sentence, until the
user types "bye". Then it prints out a farewell message and stops.

In order to decide what to print out it consults the inference
engine.

We shall give a very simple example of how to design an inference
engine -- one that really knows nothing and doesn't really do any
inference, but merely pretends to.