How ELIZA Simulated a Psychotherapist in Early AI

Created in the mid-1960s by MIT computer scientist Joseph Weizenbaum, ELIZA was one of the world's first chatbots and a milestone in early artificial intelligence. This article explores how the program successfully simulated a Rogerian psychotherapist using basic pattern matching, keyword ranking, and text substitution, ultimately tricking human users into believing the computer genuinely understood their emotions.

To simulate a psychotherapist, Weizenbaum equipped ELIZA with a specific script called DOCTOR. He chose Rogerian psychotherapy—a person-centered approach developed by Carl Rogers—because it relies heavily on the therapist reflecting the patient's own words back at them. This allowed ELIZA to ask open-ended questions without needing any actual knowledge of the real world or human psychology. By simply mirroring the user's statements, the program placed the burden of holding a meaningful conversation entirely on the human.

The core mechanic behind ELIZA was simple pattern matching, not true comprehension. When a user typed a sentence, ELIZA scanned the text for pre-programmed keywords, such as "mother," "depressed," or "always." Each keyword was assigned a rank of importance. If a user's sentence contained multiple keywords, ELIZA would focus on the one with the highest rank to formulate its response, ignoring the rest of the text.

Once a keyword was identified, ELIZA applied a decomposition rule to break the user's sentence into parts. It then used a reassembly rule to construct a response, which included flipping pronouns to make the reply grammatically correct. For example, if the user typed, "You do not understand me," ELIZA recognized the pattern "You [X] me." It would swap the pronouns and reassemble the sentence into the question, "What makes you think I do not understand you?"

When the user's input contained no recognizable keywords, ELIZA relied on clever fallback strategies to keep the illusion alive. It would output generic, non-committal phrases such as "Please go on," "That is very interesting," or "Can you elaborate on that?" Additionally, ELIZA had a basic memory function. It could store an earlier statement made by the user and bring it up later in the conversation when no keywords were found, asking something like, "Earlier you mentioned your sister. Why do you think that is?"

Despite knowing how simple the underlying code was, many early users became emotionally attached to the program, a phenomenon now known as the "ELIZA effect." People attributed human-like empathy and deep understanding to the machine simply because it used natural language. ELIZA proved that simulating human conversation did not require genuine artificial intelligence, just the clever manipulation of words and human psychology.