A topic in the Open Knowledge Graph — a free, open map of 15,290 topics and the order to learn them in.

Computational Parsing Algorithms and Complexity

Research Depth 76 in the knowledge graph ☐ I know this ☆ Set as goal
171topics build on this
400prerequisites beneath it
See this on the map →
Lambda Calculus for Linguistic Semantics→→Parsing Preferences and Computational ComplexitySyntactic Parsing Algorithms and Models
parsing algorithms computational

Core Idea

Computational parsing algorithms (CKY, Earley, shift-reduce) recover syntactic structure from sequences of words, taking as input a grammar and a sentence. Algorithms differ in complexity, coverage, and efficiency—CKY is O(n³) in sentence length for context-free grammars, while neural parsers learn patterns without explicit grammar rules. Modern statistical and neural approaches achieve high accuracy on benchmark corpora but sometimes fail in linguistically unexpected ways.

How It's Best Learned

Implement or trace through a parsing algorithm on sample sentences, observing complexity and derivation paths. Compare predictions of traditional and neural parsers on ambiguous or difficult sentences.

Common Misconceptions

Explainer

Parsing is the problem of recovering structure from a linear sequence of symbols given a grammar — the same task you do intuitively when you understand a sentence, but made explicit and formal. From your work with lambda calculus for linguistics, you know that meaning composition requires knowing structure: you can't apply the right semantic rules without knowing which phrases combine with which. A parser takes a string of words and a grammar, and returns one or more parse trees — the hierarchical structures that make semantic composition possible. The algorithmic question is: how do you find those trees efficiently, especially when the same substring can be parsed multiple ways?

The CKY algorithm (Cocke-Kasami-Younger) answers this with dynamic programming. It works on grammars in Chomsky Normal Form, where every rule has the shape A → BC or A → word. CKY builds a triangular chart: the cell at row *i*, column *j* stores all the non-terminals that can span from word *i* to word *j* in the input. It fills the chart bottom-up — first single words, then spans of length 2, then 3, and so on — reusing subresults rather than recomputing them. Because each cell combines at most two smaller cells, and there are O(n²) cells each requiring O(n) combination attempts, total complexity is O(n³) in sentence length. For typical sentences this is tractable; for very long sentences it can become slow.

Earley parsing takes a top-down, left-to-right approach that handles arbitrary context-free grammars without requiring Chomsky Normal Form. It maintains a chart of items — partially matched rules — and processes the input incrementally, predicting what rules might apply, scanning the next word, and completing rules when all their right-hand symbols have been matched. Earley is more flexible than CKY and handles ambiguous and even mildly context-sensitive grammars gracefully, though its worst-case complexity is also O(n³). Shift-reduce parsing (used in many practical NLP systems) is faster but makes early commitments: it either shifts the next word onto a stack or reduces the top of the stack by a grammar rule, with no backtracking. These commitments make shift-reduce susceptible to garden-path errors — the same temporary ambiguities that trip up human readers — and it's no accident that shift-reduce mirrors some aspects of human incremental parsing.

Neural parsers — particularly those based on deep learning over word embeddings — learn to produce parse trees from training data without explicit grammar rules. They can achieve high accuracy on standard benchmarks and handle the long-tail of constructions that hand-written grammars miss. But they fail differently from rule-based systems: they can confidently produce structurally plausible but semantically nonsensical parses for unusual inputs, and their errors don't follow the systematic patterns you'd expect from a grammar. The key insight from the misconceptions above is that efficiency and accuracy are separate axes: a fast O(n) neural model might outperform a theoretically complete O(n³) chart parser on typical text, but perform worse on the unusual sentences that fall outside its training distribution. Choosing a parser involves understanding which failure modes matter for your application.

Practice Questions 5 questions

Prerequisite Chain

Understanding Zero → The Number Zero → Counting to Five → Counting to 10 → Counting to 20 → Counting a Set of Objects Up to 20 → Cardinality: The Last Number Counted → Matching Numerals to Quantities → Subitizing Small Quantities → Addition Within 10 → Number Bonds to 10 → Addition Within 20 → Doubles and Near Doubles → Doubles Facts Within 10 → Near Doubles Facts Within 20 → Mental Math Strategies for Addition → Mental Math: Adding and Subtracting Tens → Addition Within 100 → Repeated Addition as Multiplication → Multiplication as Equal Groups → Multiplication: Arrays → Basic Multiplication Facts (0s, 1s, 2s, 5s, 10s) → Multiplication Facts Within 100 → Division as Equal Sharing → Division as Grouping (Measurement Division) → Division: Grouping (Repeated Subtraction) Model → Division: Fair Sharing Model → Division as Equal Sharing → Division as Grouping → Basic Division Facts → Division Facts Within 100 → Multiplication and Division Fact Families → Relationship Between Multiplication and Division → Division Facts as Inverse of Multiplication → Remainders and Quotients in Division → Division Word Problems → Multi-Step Word Problems → Solving Multi-Step Word Problems → Multiplication Word Problems → Division Word Problems → Introduction to Long Division → Factors and Multiples → Prime and Composite Numbers → Equivalent Fractions → Relating Fractions and Decimals → Decimal Place Value → Integers and the Number Line → Comparing and Ordering Integers → Absolute Value → Adding Integers → Subtracting Integers → Multiplying Integers → Introduction to Exponents → Order of Operations → Integer Order of Operations → Variable Expressions → The Distributive Property → Variables and Expressions Review → Introduction to Polynomials → Adding and Subtracting Polynomials → Multiplying Polynomials → Factorial → Permutations → Combinations → Counting Principles: Addition and Multiplication Rules → Introduction to Graph Theory → Propositional Logic Foundations → Logical Equivalences → Set Operations: Union, Intersection, and Complement → Cartesian Products and Relations → Partial Orders → Binary Relations → Equivalence Relations → Injective, Surjective, and Bijective Functions → Lambda Calculus → Lambda Calculus for Linguistic Semantics → Computational Parsing Algorithms and Complexity

Longest path: 77 steps · 400 total prerequisite topics

Prerequisites (1)

Leads To (2)