Dec 072017
The classic Eliza/Doctor program. Improved, expandable, with BASIC sour.
File ELIZA2.ZIP from The Programmer’s Corner in
Category Games and Entertainment
The classic Eliza/Doctor program. Improved, expandable, with BASIC sour.
File Name File Size Zip Size Zip Type
ELIZA.BAS 8030 2847 deflated
ELIZA.DAT 7168 2431 deflated
ELIZA.DOC 6546 2898 deflated

Download File ELIZA2.ZIP Here

Contents of the ELIZA.DOC file

ELIZAVersion 2.0
------------ ---

Eliza is a program that simulates intelligence by holding a
conversation with its operator. It was first conceived by Joseph Weizenbaum at
MIT in 1966 and was written in Fortran. A brief description of its operation

When the user types in a sentence, Eliza scans for "keywords" which can be
words or phrases. Each keyword has one or more responses associated with it.
These responses can be complete sentences or may require that a modified
portion of the user's text be appended to them. The portion of text is all text
to the right of the keyword. The modification is that the text is correctly
conjugated (i.e., "I" becomes "YOU"). This allows the computer to handle
different subjects "intelligently" without gigabytes of canned responses.

Why Another Eliza?
--- ------- ------

Until now, the versions available in the public domain were
deficient due to the following:

1. The number of keywords and responses was limited, which
caused the programs to be "dim". Many of these were
well written, but were developed in the days of the
Altairs and IMSAIs and were written to conserve space
in things using "MITS 8K BASIC" (ugh!).

2. Adding keywords and responses was difficult. Adding one
response could mean changing upwards of 70 pieces of
numeric data (starting and ending response numbers).
To re-order the keywords for a different priority, since
the first keyword found is the one used, was a monumental
task that could take hours.

3. Conjugation was done in an "swap" fashion. This means that
every occurrence of "YOU" was replaced with "I" and,
more importantly, vice versa. This means that if you
replaced "US" with "YOU", every occurrence of "YOU" was
replaced by "US". As a result, "US", "WE", and "ME"
would not be conjugated correctly.

4. Users were required to type in all caps without any
punctuation. Not an easy thing to do, and it certainly
didn't inspire them with a sense of awe at the intelligence
of Eliza.

5. When multiple keywords shared the same set of responses,
each keyword rotated through the responses independently.
This allowed the user to see the same response twice in a
row if there were 2 keywords with the same responses.

I believe that I have made things much easier with this version of Eliza. To
the best of my knowledge, there are no major flaws in the conjugation routine.
The user input section converts lowercase to uppercase and deletes puctuation
and extraneous characters. In addition, each set of responses is rotated
through regardless of which keyword invokes it. All keywords and responses are
kept in a file called ELIZA.DAT. This is a relatively extensive list
containing over 80 keywords. The program can handle up to 200 keywords and 300
replies (memory permitting). There can be multiple keywords that get the same
responses, such as "IM" and "I AM". The format of the file is simple and as

Keyword 1 - Keyword N-Each keyword followed by a CR/LF.
These keywords will all have the
same responses (listed below them).

!-Exclamation point (end of keywords).

Response 1 - Response N-Responses separated by CR/LFs.
If the last character of a response
is an asterisk (*), Eliza appends
the modified text to the end of it.
.-Period (end of responses).


YOU ARE-First keyword
YOURE-Second keyword (No punctuation!)
!-End of keywords
AM I REALLY?-First response
WHY DO YOU THINK I AM*-Second response (user text appended)
HOW DO YOU KNOW THAT I AM?-Third response
.-End of responses

These "records" will be repeated until the last keyword which is always
"NOKEYFOUND". This is the set of responses used when there is no keyword in
what the user has typed in. The order of these records is of vital importance!
If you have a keyword of "I" before "I LIKE", "I HATE", etc., Eliza will never
get around to looking for anything other than "I". Structure the file according
to importance. The file currently has a list of vulgarities as the first
keywords. This is so that they will always be caught and the user can be
reprimanded by Eliza.

About Modifications
----- -------------

While we would all like "just one more feature" or to make "a little
change", it's sometimes necessary to look at the overall picture. I am sick of
getting hold of the latest "version" of a program, only to find that the reason
for a new version number being assigned is that someone changed a prompt from
being a ">" to being a "*" so that it would match his version of a text editor
called NERDWRITE. I also hate to see programs being made machine specific for
no good reason. The conversion from the CP/M MBASIC version to the IBM PC
GWBASIC version required changing the names of just two variables and the
deletion of 1 line of code. The reason this was so easy is because I didn't
make the original program machine specific. If you "need" your version to do
something which is machine specific, have fun, but please don't release it into
the public domain. I am also tired of seeing "spaghetti code" written to
handle every imaginable possibility (what if his monitor is unplugged in the
middle of a record AND the printer runs out of paper while the monitor is
unplugged!?!?). In the case of Eliza, the conjugation section works for the
vast majority of cases and the logic is very easy to follow. Please don't
"fix" it because it fails to work when you type the way that Yoda speaks. The
resultant code will get so bizarre after a few such "repairs" that it will be
impossible to follow.

When modifying or adding to the ELIZA.DAT file, it is suggested that
you carefully analyze the replies you enter to make certain that they work in
nearly all conceivable cases. As an example, with a keyword of "YOU", a reply
of "WHY DO YOU THINK I*", and an input of "YOU ARE A CROOK", the result is a
reply of "WHY DO YOU THINK I AM A CROOK". Everything's fine and the reply
makes perfect sense. If, however, the user types in "I DESPISE YOU", Eliza
will reply with "WHY DO YOU THINK I", which isn't even a sentence, much less an
intelligent response. Tread carefully!

Frederick B. Maxwell, Jr. 6/13/89

 December 7, 2017  Add comments

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>