Conversations with calcELIZAr
YOU: Hey Eliza, what’s 45 and 5?
ELIZA: The sum of 45 and 5 is 50.
YOU: And what is the product of 3 and 4?
ELIZA: The product of 3 and 4 is 12.
YOU: Now: What is 2344355 divided by 0???
ELIZA: Well, 2344355 divided by 0 is not defined.
For my current course Speech and Language Processing we are supposed to submit 7 questions over time. For the second task, I decided to implement an ELIZA-like program.
ELIZA is a famous 1966 computer program by Joseph Weizenbaum, which parodied a Rogerian therapist, largely by rephrasing many of the patient’s statements as questions and posing them to the patient. Thus, for example, the response to “My head hurts” might be “Why do you say your head hurts?” The response to “My mother hates me” might be “Who else in your family hates you?”
[…]
Eliza worked by simple pattern recognition and substitution of key words into canned phrases. It was so convincing, however, that there are many anecdotes about people becoming very emotionally caught up in dealing with ELIZA. All this was due to people’s tendency to attach to words meanings which the computer never put there.
(Wikipedia)
As the program’s domain I chose simple calculations with 2 operands. You can ask questions written in normal English (well, phases that I call English
). The text at the very beginning shows an example output of the program. calcELIZAr heavily uses Regular Expressions to recognize and transform inputs. It’s written in simple JavaScript and is therefore directly available on the web:
You can test calcELIZAr at http://www.2meter3.de/calcelizar/. It’s far away from being bug-free and speaking proper English, but it’s a nice toy, though. calcELIZAr is just a little project for school, but feel free to report flaws and errors.


