| Date Assigned: | Wed Jan-31 |
| Date Due: | Thu Feb-1 |
Part 1: Using ELIZA
Back in the 1960's, almost 20 years before there were PC's and several years before the first moon shot, Joseph Weizenbaum wrote a simple program which manipulated language in order to (somewhat crudely) simulate how a therapist might respond to a patient. The program, ELIZA, is very famous now, and represents an early attempt to use computers to further our understanding of human intelligence.
There are many online versions of ELIZA. For example (randomly chosen): http://chayden.net/chayden/eliza/Eliza.shtml. Please visit this site and use ELIZA for a while. Try to get a sense of what it is doing. Identify some of its strengths and its (rather obvious) shortcomings.
Tonight we will expound on the exploration we began today in class regarding apstrings (hint: you may well want to use some or all of the code we developed in class today (your choice)). Inspired by the ELIZA program you just used, your task is to repeatedly read in sentences (stopping only when the user enters "done.", as we did in class today), and to respond to them as follows:
1. Respond to sentences of the form: "I ..." with questions of the form "Why do you... ?". For example, if the user enters "I like to eat popcorn while mumbling senselessly.", your program should output: "Why do you like to eat popcorn while mumbling senselessly?" Be sure to end your question with a question mark and not include the period from the original sentence! (Hint: you can modify a particular letter within a string. For example, to set the second (hence, index == 1) character of a string to be a 'Z', you just enter s[1] = 'Z'; which works so long as your index is not too large (if your index is larger than the string length, instead of making the string larger, apstring just crashes. Weee.)
2. Respond to any other sentences with a simple "I do not understand."
Good luck!
DK