Constituency parsing

On this page 7

Constituency parsing is the task of analyzing a sentence into a hierarchy of nested phrases, called constituents, and representing the result as a phrase-structure tree whose leaves are words and whose internal nodes carry labels such as NP (noun phrase), VP (verb phrase) or PP (prepositional phrase). In speech & language AI, it is one of the two classic forms of syntactic analysis, alongside dependency parsing.

The approach rests on context-free grammar and the linguistic idea that words group into units that behave as a whole. A constituency parser answers questions such as which words form the subject, where a clause begins and ends, and which phrase a modifier attaches to, which makes it useful for grammar-aware text processing, linguistic research and the evaluation of language models.

How constituency parsing builds a phrase-structure tree

A constituency parser builds a tree in which every internal node spans a contiguous sequence of words and carries a syntactic category. The sentence “The analyst reviewed the report” becomes a sentence node S with two children: the noun phrase “The analyst” and the verb phrase “reviewed the report”, which itself contains a verb and another noun phrase.

The lowest layer above the words holds part-of-speech tags, so constituency parsing usually depends on or jointly performs part-of-speech tagging. Labels follow an annotation scheme; the most widely used is the Penn Treebank tag set, which defines roughly 26 phrase labels and 36 part-of-speech tags for English.

The table below lists the phrase labels that appear in almost every English parse.

LabelMeaningExample span
SSimple declarative clauseThe analyst reviewed the report
NPNoun phrasethe quarterly report
VPVerb phrasereviewed the report
PPPrepositional phrasein the morning
SBARSubordinate clausebecause the deadline moved
ADJPAdjective phrasevery detailed
Frequent Penn Treebank phrase labels

The structure encodes attachment decisions that change meaning. In “She saw the man with the telescope”, the PP may attach to the verb phrase (she used the telescope) or to the noun phrase (the man had it). Resolving such structural ambiguity is the core difficulty of the task.

Algorithms for constituency parsing

Constituency parsing algorithms fall into three broad families: chart-based dynamic programming, transition-based shift-reduce systems and sequence-based neural methods. Each family represents the search over possible trees differently and offers a distinct trade-off between accuracy and speed.

The classic CKY algorithm fills a chart of all spans using a grammar in Chomsky normal form and runs in cubic time in sentence length. Probabilistic context-free grammars (PCFGs) attach probabilities to rules so the parser returns the most likely tree. Modern span-based neural parsers keep the chart search but score each span with a neural encoder, often a pretrained transformer.

The comparison below summarizes how the main approaches differ.

ApproachSearch methodTime complexityTypical strength
PCFG with CKYDynamic programming over spansCubicExact search, interpretable rules
Lexicalized PCFGChart parsing with head wordsHigher than cubicBetter attachment decisions
Shift-reduce parserGreedy or beam transitionsLinearHigh speed on long texts
Span-based neural parserCKY over neural span scoresCubicState-of-the-art accuracy
Sequence-to-sequence parserGenerates a bracketed stringLinear in output lengthSimple pipeline with large models
Main families of constituency parsers

With transformer encoders, the best English parsers reach a labeled bracketing F1 of about 95 to 96 on the Penn Treebank test set, compared with roughly 90 for strong statistical parsers of the 2000s.

Constituency parsing compared with dependency parsing

Constituency parsing and dependency parsing describe the same sentence from different perspectives. Constituency trees group words into phrases, while dependency trees link each word directly to its syntactic head with a labeled relation such as subject or object, without intermediate phrase nodes.

AspectConstituency parsingDependency parsing
Basic unitPhrase spanning several wordsHead-dependent word pair
Node countWords plus phrase nodesOne node per word
Grammar basisContext-free phrase structureDependency grammar
Word order freedomHandles fixed order bestHandles free order well
Common benchmarkPenn TreebankUniversal Dependencies
Constituency and dependency representations

The two formats are partly convertible: head-finding rules transform a constituency tree into a dependency tree, but the reverse conversion loses information. Multilingual projects increasingly prefer Universal Dependencies, while constituency trees remain the standard where phrase boundaries matter.

Evaluation and practical use

Parsers are evaluated with PARSEVAL metrics, which compare predicted and gold constituents as labeled spans. Labeled precision, labeled recall and their harmonic mean, the bracketing F1 score, are usually computed with the evalb tool, which ignores punctuation and certain labels by convention.

In applied systems, constituency trees support phrase extraction, sentence compression, grammar checking, syntax-aware machine translation and linguistic corpus search. They also serve as probing targets for testing whether large language models encode syntax internally.

  • Extracting noun phrases for terminology mining and keyword lists.
  • Splitting complex sentences at clause boundaries for text simplification.
  • Checking grammar by detecting incomplete or misplaced phrases.
  • Supporting semantic role labeling with phrase-level argument candidates.

Limitations and common errors

Constituency parsers remain sensitive to domain shift: a model trained on newswire loses several F1 points on social media, clinical notes or transcribed speech. Errors concentrate in a few predictable constructions.

Error typeCauseMitigation
PP attachmentSeveral valid hosts for a phraseLarger contexts and pretrained encoders
Coordination scopeUnclear extent of conjoined phrasesSpecialized features or reranking
Disfluent speechRepairs and fillers break structureDisfluency removal before parsing
Out-of-domain textVocabulary and style differFine-tuning on in-domain treebanks
Typical constituency parsing errors

Treebanks are expensive to annotate, so many languages lack large constituency resources. Annotation schemes also differ between languages, which limits cross-lingual transfer and makes direct score comparisons misleading.

In simple terms

A sentence is more than a row of words. Words form groups, and groups form bigger groups. Constituency parsing finds these groups. It shows them as an upside-down tree.

Think of a family tree. The whole sentence sits at the top. Below it are big parts, like who did something and what they did. Each part splits into smaller parts, down to single words. The tree tells a computer which words belong together. That helps it read the sentence the right way.

A practical example

A legal technology team builds a tool that flags ambiguous clauses in contracts. Lawyers want to know when a modifier such as “for a period of three years” could attach to more than one obligation in the same sentence.

The team runs a span-based neural constituency parser on each clause and inspects the top three candidate trees. When the parser assigns similar scores to trees with different PP attachments, the tool highlights the phrase for review. On a test set of 2,000 annotated clauses, the tool finds about 80 percent of the ambiguities that senior lawyers marked, while producing a manageable number of false alarms. Reviewers then rewrite the flagged clauses before signing, which reduces later disputes over contract wording.