liveBook · Manning

Pattern matching

As explained in Understanding AI

Pattern matching is the computational technique of identifying input structures that correspond to predefined or learned patterns.

Why can a machine sound attentive without understanding what you mean? Pattern matching identifies structures in input, then connects them to predefined or learned responses. The result may feel meaningful because language has recognizable structure, even when no interpretation or emotion is involved. section 1.1

A simple rule-based pattern-matching process works like this:

  • Detect keywords in the input, such as “feel,” “my,” or “think.” section 1.1
  • Match the input against a predefined structure, such as “I feel X” or “I think X.” section 1.1
  • Transform the captured phrase into a response template, such as “Why do you feel X?” section 1.1

ELIZA’s convincing illusion

When a user says, “I feel unhappy about my job,” ELIZA can recognize the “I feel X” pattern, reuse “unhappy about my job,” and ask, “Why do you feel unhappy about your job?” The reply sounds therapeutic because open-ended questions resemble a therapist’s style. Yet ELIZA is transforming words with rules, not analyzing the user’s situation or forming an opinion. Repetition eventually exposes the mechanism. section 1.1

Modern AI systems replace hand-written rules with patterns learned from large datasets, making them more flexible while preserving the basic distinction between fluent output and genuine understanding. This helps explain both their usefulness and why confident answers still need questioning. section 1.1.2

How Understanding AI covers it

How deep it goes
Defines keyword detection, structural matching, and template transformation, then contrasts rules with learned patterns without explaining model internals.
Examples
Uses ELIZA’s keyword rules, “I feel X” templates, therapeutic questions, and the contrast between ELIZA and modern AI.
What you can do after
Evaluate/understand when fluent AI responses may simulate meaning rather than demonstrate understanding.
How it connects
Connects pattern matching to rule-based systems, natural language, modern AI systems, and the Turing Test.

Also explained in

Compare how 16 books explain pattern matching →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Understanding AI. The section links point to the parts of the book it draws on.