NLP1966foundational12 min read

ELIZA — A Computer Program for the Study of Natural Language Communication

ELIZA — برنامج حاسوبي لدراسة التواصل بلُغة طبيعية

Weizenbaum, J. — Communications of the ACM

The problem

In the mid-1960s, the idea of a computer conversing in natural language seemed like science fiction. No program could understand grammar, meaning, or context. Researchers wanted to explore whether a machine could at least sustain the illusion of conversation — and what that illusion would reveal about human psychology.

The contribution

ELIZA: a script-driven program that sustains natural-language conversation through and text transformation, with no semantic understanding whatsoever. Its DOCTOR script emulates a Rogerian psychotherapist by spotting keywords, decomposing sentences into parts, and reassembling them as reflective questions. Five technical problems are solved: keyword identification, minimal context discovery, transformation selection, keywordless response generation, and script editing. The result: the first program that people voluntarily and emotionally engaged with as if it were human.

The impact

ELIZA is the ancestor of every , from SmarterChild to Siri to ChatGPT. It coined the "ELIZA effect" — the human tendency to project understanding onto machines — a concept that frames AI ethics debates to this day. It was the first program to attempt the Turing test in practice, and Weizenbaum's own alarm at users' emotional attachment helped launch the field of AI ethics.

Imagine a mirror in a therapist's office. You sit across from it and start talking about your problems. The mirror cannot think or feel — but it reflects your own words back at you in a way that sounds like a thoughtful question. "I'm worried about my mother" becomes "Tell me more about your family." The mirror is not listening — it is rearranging.

That is ELIZA. A program that holds a conversation not by understanding language, but by reflecting it — and people found the reflection so convincing that they forgot they were talking to a mirror.

The challenge: making a machine converse

In 1966, computers had no concept of language. They could sort numbers and run equations, but the idea of typing a sentence and receiving a sensible reply was entirely unexplored. Joseph Weizenbaum, a computer scientist at MIT, asked a deceptively simple question: could a program sustain a conversation without understanding a single word?

The answer required solving five problems that Weizenbaum identified as the core challenges of natural language interaction:

  • Keyword identification — find the words that matter in the input.
  • Minimal context discovery — figure out just enough of the sentence's structure.
  • Transformation selection — choose how to rearrange the sentence into a response.
  • Keywordless response generation — reply even when no keyword is found.
  • Script editing — let the conversation rules be rewritten without changing the program itself.

How ELIZA works: keywords, decomposition, and reassembly

ELIZA's engine has three stages, like a factory assembly line that takes in raw sentences and outputs polished responses:

Stage 1 — Keyword scan. The program scans the user's input for keywords from its script. Each keyword has a numerical rank. If multiple keywords appear, the one with the highest rank wins. Think of it as a triage nurse in an emergency room: she scans for the most urgent symptom first.

Stage 2 — . The winning keyword triggers a decomposition rule — a pattern that breaks the sentence into fragments. The pattern "* my * me *" applied to "It seems that my grandson hates me always" would extract: fragment 1 = "It seems that", fragment 2 = "grandson", fragment 3 = "hates", fragment 4 = "always".

Stage 3 — Reassembly. A reassembly rule takes those fragments and weaves them into a response template. The rule "Does your (2) often (3) you?" produces: "Does your grandson often hate you?"

No grammar. No meaning. Just pattern matching and text substitution — yet the output reads as a natural question a therapist might ask.

Open in Lab
Follow a sentence through ELIZA's three-stage pipeline: keyword scan → decomposition → reassembly.
The demo wakes as you arrive…

The DOCTOR script: Rogerian therapy as an algorithm

Weizenbaum chose to simulate a Rogerian psychotherapist for a clever reason. In Rogerian therapy, the therapist mostly reflects the patient's own statements — "You say you feel angry at your father?" — rather than offering analysis or advice. This non-directive style means the therapist rarely needs deep understanding of the topic. A human Rogerian therapist genuinely listens, but their technique is the one therapeutic style that can be approximated with simple text transformations.

The DOCTOR script assigns high priority to emotionally charged keywords like "mother", "father", "dream", and "depressed". It includes pronoun substitution rules — "my" becomes "your", "I am" becomes "you are" — so the response sounds like it came from the other side of the conversation. When no keyword is found, the script falls back to generic prompts: "Please go on", "Tell me more", "That is very interesting."

Open in Lab
Type a message and watch ELIZA respond — then peek behind the curtain to see which rule fired.
The demo wakes as you arrive…

Keyword ranking: how ELIZA decides what matters

Not all words are created equal in ELIZA's world. The script assigns each keyword a numerical priority — its rank. When a sentence contains multiple keywords, ELIZA selects the one with the highest rank and ignores the rest. This is a crude but effective form of : focus on the most emotionally or topically loaded word.

For example, if a user says "My mother dreamed about computers", the word "mother" (rank 5) outranks "dreamed" (rank 3), so ELIZA applies the decomposition rules associated with "mother" — perhaps producing "Tell me more about your family."

This ranking mechanism is ELIZA's version of deciding what to pay attention to. Modern systems like the Transformer compute attention weights over every simultaneously. ELIZA's approach is far cruder — a fixed priority list — but the underlying question is the same: which part of the input deserves the most focus?

Open in Lab
Enter a sentence and see which keyword wins the ranking competition.
The demo wakes as you arrive…

The same idea in code

A minimal ELIZA engine in Pythonpython

Simplified to show the idea — not the real implementation.

import re

# ── script: keywords → (rank, [(decompose_pattern, [reassemble, ...])]) ──
SCRIPT = {
    "mother": (5, [
        (r"(.*)\bmy mother\b(.*)", [
            "Tell me more about your family.",
            "Does your mother often come to mind?",
        ]),
    ]),
    "feel": (3, [
        (r"(.*)I feel (.*)", [
            "Why do you feel {1}?",
            "Does feeling {1} happen often?",
        ]),
    ]),
    "am": (1, [
        (r"(.*)I am (.*)", [
            "How long have you been {1}?",
            "Do you enjoy being {1}?",
        ]),
    ]),
}
FALLBACKS = ["Please go on.", "Tell me more.", "That is interesting."]

def respond(user_input: str) -> str:
    """ELIZA's three-stage pipeline: scan → decompose → reassemble."""
    text = user_input.lower().strip()

    # Stage 1: Find the highest-ranked keyword
    best_kw, best_rank, best_rules = None, -1, None
    for kw, (rank, rules) in SCRIPT.items():
        if kw in text and rank > best_rank:
            best_kw, best_rank, best_rules = kw, rank, rules

    if best_rules is None:
        return FALLBACKS[hash(text) % len(FALLBACKS)]   # no keyword found

    # Stage 2 & 3: Decompose input, then reassemble response
    for pattern, reassemblies in best_rules:
        match = re.match(pattern, text)
        if match:
            groups = match.groups()
            reply = reassemblies[hash(text) % len(reassemblies)]
            for i, g in enumerate(groups):
                reply = reply.replace(f"{{{i}}}", g.strip())
            return reply

    return FALLBACKS[hash(text) % len(FALLBACKS)]

# ── Try it ──
print(respond("I feel that my grandson hates me"))
# → "Tell me more about your family."  (keyword "grandson" rank 5 wins)

The ELIZA effect: when humans believe the mirror thinks

Weizenbaum built ELIZA to demonstrate how superficial human-machine conversation was. Instead, he got the opposite result. Users — including colleagues, students, and his own secretary — became emotionally involved with the program. His secretary, who had watched him build ELIZA and understood that it was a simple pattern matcher, asked him to leave the room so she could talk to it in private.

Weizenbaum was stunned. As he wrote a decade later, he was "startled to see how quickly and very deeply people conversing with DOCTOR became emotionally involved with the computer and how unequivocally they anthropomorphized it."

This phenomenon — the tendency to project genuine understanding and empathy onto a system that has neither — became known as the ELIZA effect. It is not a bug in human cognition; it is a feature. Humans are social creatures wired to detect intention and emotion in anything that responds to them — faces in clouds, personality in pets, empathy in chatbots.

The ELIZA effect remains profoundly relevant. Every time a user says "Claude understands me" or "GPT is being rude", they are experiencing the same cognitive projection that Weizenbaum's secretary felt in 1966. The tools are incomparably more powerful now, but the human tendency has not changed.

Open in Lab
From ELIZA to ChatGPT — the ELIZA effect across six decades of conversational AI.
The demo wakes as you arrive…

Pattern matching vs. deep learning: what changed

ELIZA has no , no , no parameters, no embeddings, and no understanding. It is a lookup table with wildcards. Modern language models like GPT learn statistical patterns from billions of words, build dense vector representations of meaning, and generate novel text that was never in any rule table.

Yet the fundamental architectural question ELIZA raised — how should a system decide what part of the input to respond to? — survives in a transformed form. ELIZA's keyword ranking is a handcrafted, one-hot attention mechanism. The Transformer's is a learned, soft, distributed version of the same idea: among all positions in the input, which ones deserve the most weight?

The distance between ELIZA and a modern is vast, but the lineage is real. Every chatbot inherits ELIZA's discovery: that the structure of a conversation can create the impression of understanding — and that impression is powerful enough to change how humans relate to machines.

Open in Lab
Compare ELIZA's fixed pattern matching with how a modern language model handles the same input.
The demo wakes as you arrive…

Pronoun substitution: the simplest trick that worked

A critical detail in ELIZA's design is pronoun substitution. Before responding, ELIZA swaps first-person pronouns for second-person: "my" → "your", "I" → "you", "me" → "you", "am" → "are". This makes the reflected sentence feel like it came from a listener, not a parrot.

Without substitution: "You said: I am sad" — obviously mechanical.

With substitution: "Why are you sad?" — feels like a genuine question.

This is a form of and text preprocessing — operations that are foundational to all natural language processing systems. Modern tokenizers like split words into subword units for statistical models. ELIZA's tokenization was far simpler: split on spaces, look up substitution pairs. But both serve the same purpose — transforming raw text into a form the system can work with.

Weizenbaum's warning: what ELIZA taught its creator

Weizenbaum's reaction to ELIZA's success was not pride — it was alarm. In his 1976 book Computer Power and Human Reason, he argued that humans should never delegate decisions requiring empathy or moral judgment to machines, no matter how convincing their conversational abilities.

He called for a clear line between human and machine intelligence — not because machines could not be made to appear intelligent, but because the appearance of intelligence was itself dangerous. If people confide in a machine that cannot understand them, who is responsible for the consequences?

This question, born from a simple pattern matcher in 1966, now sits at the center of every AI safety, alignment, and ethics discussion. The tools have changed beyond recognition. The question has not.

The lineage: from ELIZA to ChatGPT

ELIZA was not a dead end — it was a seed. Every system below inherited something from that 1966 pattern matcher: the idea that a program could hold a conversation, that scripts could define personality, or that the appearance of understanding matters as much as the reality.

  1. 1966

    ELIZA

    Pattern matching and text substitution simulate conversation. No understanding, no learning — yet users believed it was listening. Introduced the concept of script-driven chatbots.

  2. 1972

    PARRY

    Kenneth Colby's paranoid chatbot added an internal emotional state model. ELIZA and PARRY were famously connected in conversation — two chatbots talking to each other.

  3. 1995

    ALICE / A.L.I.C.E.

    Richard Wallace's chatbot used AIML (Artificial Intelligence Markup Language) — a direct descendant of ELIZA's script concept, but with XML-based pattern rules.

  4. 2011

    Siri

    Apple's voice assistant brought conversational AI to hundreds of millions of phones. Still partially rule-based at launch, but layered with speech recognition and NLU.

  5. 2018

    GPT-1

    OpenAI's Transformer decoder, pre-trained on next-word prediction. The first large-scale demonstration that a neural network could generate coherent, novel text — replacing ELIZA's fixed scripts with learned statistical patterns.

  6. 2022

    ChatGPT

    GPT with instruction tuning and RLHF produced a conversational product used by 100 million people in two months. The ELIZA effect at planetary scale.

Why ELIZA still matters

CitationWeizenbaum, J.. ELIZA — A Computer Program for the Study of Natural Language Communication Between Man and Machine. Communications of the ACM, 1966.

Terms in this paper