How it works
Type a sentence and step through exactly what ELIZA does with it.
ELIZA does not read a whole sentence at once. It scans left to right and breaks the input at three delimiters: the comma, the full stop, and the word BUT. Leading clauses that contain no keyword are thrown away; as soon as a clause with a keyword is found, ELIZA stops at the next delimiter and works only on that clause. So “You are not very aggressive but I think you don’t want me to notice that” is cut at but, and ELIZA replies only to “you are not very aggressive”. The comma and full stop are described in Weizenbaum’s 1966 paper; the BUT delimiter is present in the recovered source though it is not mentioned there.
ELIZA can also ‘remember’. When you say something about what is yours (a sentence the MY keyword catches), ELIZA transforms it and files it away. It chooses from four memory templates, picked by a hash of the last word you typed, so “my mother takes care of me” becomes a stored phrase like BUT YOUR MOTHER TAKES CARE OF YOU. These phrases queue up in the order they were made.
A counter runs quietly alongside, cycling 1, 2, 3, 4. When it reaches 4 and your latest line contains no keyword, ELIZA reaches into the queue and replays the oldest stored phrase instead of a bland “please go on”. This is the “certain counting mechanism” Weizenbaum mentioned but never explained; the recovered source shows it exactly, four memory templates (MYTRAN(4)) and a one-to-four counter, with the stored phrases held in an open-ended list. Watch the memory bar in the demo above fill and get pulled out at the end as you play the 1966 conversation.
This visualisation repurposes Anthony Hay’s faithful reconstruction of ELIZA (released CC0 public domain): his engine generates the responses exactly as Weizenbaum’s 1966 program would, and we use it to demo each step.
His code runs essentially unchanged. We lifted the engine out of his eliza.html (removing only its on-screen terminal) and left the algorithm untouched, then wrapped it in a small harness that loads the 1966 DOCTOR script and runs a single response. It talks to the demo through Hay’s own tracer interface: ELIZA already supports a step-by-step trace mode, so we add a tracer that records each step the engine takes (keyword ranking, decomposition, reassembly, memory), and the display turns those records into the panels above. Both the harness and tracer (eliza-hay.js) and the display (trace.js) are available to view.