Eliza
For this assignment, you are to implement a rudimentary version of Eliza,
the program that we have seen in class.
You may choose any programming language to implement this assignment.
The Eliza program is part of the emacs editor. In any UNIX system,
enter "emacs" to get going. Once in emacs, hit the "esc" key then the "x"
key, then type "doctor" and hit return.
To see how sophisticated this can get, have a look at the pages of the
Loebner Prize competition.
To review, there are three components to Eliza, which will be run in
this order.
- One that attempts to parse the user's response
- One that searches for keywords
- One that issues random responses
It is easiest to implement these components in reverse order.
- The driver
- Your software should write an introductory message which informs
the user about the purpose of the program.
- Your software should then enter a loop where it reads in a line
from the user.
- If the user's response is "bye" terminate the program.
- All other responses should be first passed to the parse component.
If it is not successful in finding the keyword "I", then the response
should be passed to the keyword component. If this component finds a
keyword in the users sentence, do what needs to be done. If not, then
call the random response component.
- Random responses
- Incorporate at least ten random responses.
- The challenge is to come up with phrases that make sense,
independent of the context. Professors are good at using those
phrases. For example, a phrase that almost always works is:
That is interesting.
- Keyword responses
- Incorporate at least ten keyword responses.
- You may decide to have more than one response associated with a
particular keyword.
- Suppose that the first keyword is "love". If it appears in
the user's input, you will output a pre-stored phrase that is somewhat
related to the keyword. One such phrase might be: Everybody loves
somebody sometime.
- Parsing
- This is the hardest component and one on which you can spend an
infinite amount of time.
- We want you to look at the response of the user and see whether
they refer to themselves by using the pronoun "I". If so, replace all
pronouns that refer to the user by the appropriate pronoun. You may
also have to replace certain verbs. Prepend Eliza's response by an
appropriate leading phrase. Incorporate at least three leading
phrases.
- For example, if the user states: I feel depressed. you may
reply with: Is it often that you feel depressed? Notice that
the phrase: Is it often that works pretty much most of the
time. The "I" has been replaced by "you" and the full stop has been
replaced by a question mark.
Turning in your work
This assignment is due on Tuesday, Sep. 4, BC. Please zip all
necessary files and submit them to the appropriate drop-box on Angel.