

                        ELIZA - The HP48 Psychologist
                               by Karsten Hahn
                               
1. ELIZA - An introduction
ELIZA was originally written by Joseph Weizenbaum in the late '70s using Lisp.
It was thought to be joke program, but some people misunderstood and took it 
seriously. 
ELIZA can understand simple sentences, and reply to them. It's written to do
some psychonalysis with you. ELIZA can in no way replace a real doctor, if you
take the things your HP will reply serious, it's your problem. ;-] If you
follow some simple rules (-> 4.ELIZA - The rules) ELIZA will give you some
time of fun.



2. ELIZA - Legal stuff
This software is presented as is, without warrantee of any kind.  The user
bears all risk. ELIZA was written on a HP48GX Rev. R, but I think it must work
with all revisions (hope so). If you have problems or you've found a bug,
contact me. But I do NOT promise that I fix the bugs. I don't even know if I
ever work on this program again. But try to convince me, maybe it'll help.

If you want the source code of ELIZA (written in SysRPL, the frontend in
UserRPL) email me. Please write, what you want to do with the code. You can
use it in every noncommercial way you want, but I want to  know, where my code
is going to. This is NOT an option! I will NOT send you the code on a disc or
as a listing. The only way to get it is via eMail! And I warn you: This is my
first program for the HP, and it's maybe very fussy! 

Because there's a lot of work in this program (a long rainy weekend), I think
it would be fair if you write me a picture postcard, if you like the program
or if you hate it or if you found a bug or ...
I also like getting some email ... And if you want to send me some money, 
please feel free to do so. ;-)
Let's see how far this little piece of code can get.



3. ELIZA - Instalation, Using and Removing
Version 1.01: LIBRARY 1717, "ELIZA : Computer Psychologist":  6440 bytes


3.1 Installing ELIZA
ELIZA is a auto-attach library. Installing a lib is a bit more difficult than
installing a normal program. The library number is 1717. I've only got the
list from Goodie Disc 8 (by Joe Horn) which is some years old. But this number
isn't used at this time, so I hope it isn't by now, too. Installing:
    
    1. Download the file ELIZA via binary transfer to your HP 
    2. Put the library on the stack via pressing the ELIZA softkey (menu key)
    3. Key in the port number. If you don't have a RAM-Card, it's usually 0
    4. Press 'STO'
    5. Turn your HP off and then on again. You'll find ELIZA in the LIBRARY
       MENU (right shift '2' on my HP48GX)
    6. Kill the ELIZA var: 'ELIZALIB' PURGE <ENTER>
    
That's all. Now you can use ELIZA the same way you use every other programm.

     
3.2 Using ELIZA
Using ELIZA is simple. Once you've installed ELIZA, start with the command
ELIZA <ENTER> (or the softkey in the library menu). ELIZA will say hello to
you and waits for your input. After you typed your input (-> 4.ELIZA - The
rules) ELIZA will think of a good reply (somtimes it is not THAT good
actually :-}). The answer will be print at the top of your screen and a new
input is requested. If you type INFO at the prompt a dialogbox will pop up,
showing my name ;-] and the version number. If you use a S/SX there will only
be a string showing the same (because the S/SX has no idea what a dialogbox
looks like :-[). The command QUIT quits the ELIZA program.
Now go playing with that program. Have fun. Try everything, you'll see what
gets you some good replies and what won't :-]


3.3 Removing ELIZA
You'll have to do the following steps:

    1. Type :0:1717 and press <ENTER> (1717 is the number of the library, 0 is 
       the port num. If you've used another port, type the port num instead)
    2. Press <ENTER> again 
    3. DETACH <ENTER>
    4. PURGE <ENTER>
    
and ELIZA is in data nirvana.



4. ELIZA - The rules
Since ELIZA is a program that uses less than 1kByte of memory (the rest are
the string tables and the frontend program) it must be clear that this program
can do no wonders. ELIZA is a program that accepts natural English as input
and carries on a resonably coherent conversation based on the psychoanalytic
techniques of Carl Rodgers. You will have to forgive ELIZA for being a poor
English student. To get some useable respones use the following rules:
    
    1. All your input must be in upper case, otherwise ELIZA will understand
       about nothing !
    2. Use no punctuation in your input
    3. Use only short main sentences, no subordinate clauses
    4. Write your input as short as possible, if you get no proper answer
       try to formulate it another way
    5. Since ELIZA only answers your input you have to carry the conversation
    6. Because all "'"s will be cut out, you need not type them (I'M -> IM)
    7. ELIZA cannot distinguish between I and ME. Pleas forgive.
       (WHY DO YOU WANT ME TO SING = WHY DO YOU WANT I TO SING)
    8. Somtimes ELIZA uses punctuation, sometimes not.
    9. Somtimes there are too much spaces in a sentence. But I'm too lazy to
       fix that bug in this version. So please overread them.
   10. Try avoiding the use of "YOU" or "I" at the end of a sentence
   11. DON'T TAKE THE REPLIES TOO SERIOUS. THIS IS A FUN PROGRAM, NOT A 
       REPLACEMENT FOR YOUR DOCTOR !
       
If you get a reply in very bad English it's not the fault of my poor English.
It's the fault of the algorithms used in this program. But due to the lack of
main memory on your HP I think there can be not much improvement on that.
Max length of input is 60 chars. Everything longer will be cut off!



5. ELIZA - A sample dialog
This is a real sample of a ELIZA run. I got all these answers in this order!

      HI, I'M ELIZA. WHAT'S YOUR PROBLEM?
    > HI MY NAME IS KARSTEN
      I DON'T CARE ABOUT NAMES.
    > OH
      CAN YOU ELABORATE ABOUT THAT?
    > WHY SHOULD I
      WHAT ANSWER WOULD PLEASE YOU MOST?
    > NONE I GUESS
      I SEE.
    > COMPUTERS DON'T HAVE EYES
      ARE YOU SURE?
    > WHAT DO YOU MEAN
      WE WERD DISCUSSING YOU -- NOT ME:
    > I FORGOT
      SAY DO YOU HAVE ANY PSYCHOLOGICAL PROBLEMS?
    > YES I HATE YOU
      YOU'RE NOT REALLY TALKING ABOUT ME, ARE YOU?
    > SURE I'M TALKING ABOUT YOU
      DID YOU COME TO ME BECAUSE YOU ARE TALKING ABOUT I
    > NO
      WHAT DOES THAT SUGGEST TO YOU?
    > YOU ARE NOT MY FRIEND
      PERHAPS YOU WOULD LIKE TO BE NOT MY FRIEND
    > BUT I AM NOT YOUR FRIEND
      HOW LONG HAVE YOU BEEN NOT MY FRIEND
    > EVER
      I'M NOT SURE I UNSDERSTAND YOU FULLY.
    > YEAH YOU ARE STUPID
      DO YOU SOMETIMES WISH YOU WERE STUPID
    > NO
      ARE YOU SURE?
    > THAT'S ENOUGH I'M OFF
      HOW LONG HAVE YOU BEEN OFF
    > QUIT



6. ELIZA - some ideas for extensions
You can't change ELIZA if you don't have the source. But you can change the 
frontend. In the library is a program called EELIZA which is the main program
in fact. ELIZA is only a frontend to get your input and show the answers your
HP replies. EELIZA needs a string for input and returns your input string with
a leading space and two spaces at the end (this is for internal examinations)
and the reply string. So you can use EELIZA and write a new (better) frontend.
If you've hacked a nice one, please email it to me.
The EABOUT command puts 4 strings on the stack:

    4: "ELIZA Vx.xy"         Verion number of ELIZA. If you got a test ver,
                             y is a alpha or beta char, otherwise a num. 
    3: "(c) by Karsten Hahn" my name. Very important. ;-]
    2: "DD.MM.YYYY"          Date of creation
    1: ""                    special version description (beta test ver, ..)

This var is thought to give you some information you can use in your own
frontend program. So you can write ONE frontend for ALL ELIZA versions!
I am also willing to email you the source code of ELIZA (-> 2.ELIZA - Legal
stuff), so you can write a much better version of ELIZA... 



7. ELIZA - the XLIB's
This is only for the hackers!

          Addr       ROM WORD Type    Hid/Alg  User Name
         02B94 XLIB 1717    0 ::               ELIZA
         0252E XLIB 1717    1 ::               EELIZA
         0247E XLIB 1717    2 ::               EABOUT
         00066 XLIB 1717    3 ::           H   $CONFIG
         00099 XLIB 1717    4 {            H   SENTENCE
         01D4F XLIB 1717    5 {            H   REPLIES
         020A7 XLIB 1717    6 {            H   KONJ
         021A3 XLIB 1717    7 {            H   KEYWDS


You can get the description of the vars with the source code.



8. ELIZA - Thanx to ...
Hewlett Packard - for the best 'calculator' in the world ...
                - for great developing tools, and good documentation
James Donnelly  - for his fantastic 'HP 48 Handbook'
Joe Horn        - for the Goodie Discs and all the help in the net



HAVE FUN!
             Karsten Hahn



Adress: Karsten Hahn, Hessigheimer Str.1, 71522 Backnang, Germany
eMail:  un9q@rz.uni-karlsruhe.de


