What a syntax tree represents
A syntax tree is a branching diagram. The words sit at the bottom as leaves. Each label above them names a category, such as noun (N), verb (V), noun phrase (NP) or verb phrase (VP). The top node is usually S, for sentence.
The tree records constituents, which are groups of words that behave as a unit. In the sentence The dog chased a cat, the words a cat form a noun phrase. Substitution and question-answer tests support this. The phrase can be replaced by it, and it can stand alone as the answer to a question such as What did the dog chase?
How a parse is built
Parsing works by applying rules that say which categories can combine. A simple phrase structure grammar contains rules such as S goes to NP VP, NP goes to Det N, and VP goes to V NP. Each rule becomes one branching in the tree.
Parsing can proceed top down, starting from S and predicting what must follow. It can also proceed bottom up, starting from the words and combining them into larger units. Computer parsers use both ideas, and many are trained on collections of sentences that people have already annotated.
Worked example: The dog chased a cat
Use the three rules above, plus Det for the words the and a, N for dog and cat, and V for chased. The sentence has 5 words. Bottom up, the first two words give NP (Det the, N dog). The last two give a second NP (Det a, N cat). The verb chased and the second NP give VP. The first NP and the VP give S.
Count the nodes. There are 5 word-level category nodes (Det, N, V, Det, N), 2 NP nodes, 1 VP node and 1 S node. That is 5 + 2 + 1 + 1 = 9 labelled nodes, not counting the words themselves. The three phrase rules are applied four times (S once, VP once, NP twice), and each application produces one of the 4 phrase nodes.
Ambiguity and common misconceptions
Some sentences have more than one valid tree. In I saw the man with the telescope, the phrase with the telescope can attach to the verb, meaning the telescope was used for seeing. It can instead attach to the noun man, meaning the man had the telescope. Two trees show two meanings.
A common mistake is to think a tree shows the order in which a speaker produces words. It shows structure, not real-time processing. Another is to think there is one correct tree format. Textbooks differ, and dependency trees link words directly instead of forming phrases.
Where syntax trees are used
Linguists use trees to state and test hypotheses about grammar. Teachers use them to explain clause structure. Language technology uses parsers in tasks such as machine translation, grammar checking and information extraction.
Key terms
- Constituent
- A word or group of words that functions as a single unit in a sentence.
- Phrase structure rule
- A rule that states how a category can be built from smaller categories, for example S goes to NP VP.
- Parsing
- The process of assigning a syntactic structure to a sentence.
- Noun phrase
- A phrase built around a noun, such as the dog.
- Syntactic ambiguity
- A property of a sentence that allows more than one valid structure.
- Dependency tree
- A tree that links words directly to the words they depend on, without phrase nodes.
