Shallow Parsing
Shallow parsing (also called chunking) identifies useful groups of words in a sentence — noun phrases, verb phrases, prepositional phrases — without building the complete grammatical tree a full ("dee
Shallow parsing (also called chunking) identifies useful groups of words in a sentence — noun phrases, verb phrases, prepositional phrases — without building the complete grammatical tree a full ("deep") parse would produce. This lesson works through an actual chunking pass on a real sentence, using a concrete grammar rule rather than just naming the phrase types, and names the specific kind of ambiguity shallow parsing structurally cannot resolve.
A Worked Chunking Example
Take the sentence "The quick brown fox jumps over the lazy dog," first tagged with its part of speech for each word (DT = determiner, JJ = adjective, NN = noun, VBZ = verb, IN = preposition):
The/DT quick/JJ brown/JJ fox/NN jumps/VBZ over/IN the/DT lazy/JJ dog/NN
A simple chunking rule for a noun phrase — NP := DT? JJ* NN (an optional determiner, zero or more adjectives, then a noun) — is applied by scanning the tagged sequence for stretches that match this pattern:
The/DT quick/JJ brown/JJ fox/NN -> matches DT JJ JJ NN -> chunk as [NP The quick brown fox]
jumps/VBZ -> a single verb -> chunk as [VP jumps]
over/IN -> a preposition, starts a PP
the/DT lazy/JJ dog/NN -> matches DT JJ NN -> chunk as [NP the lazy dog]
A prepositional-phrase rule — PP := IN NP — then combines the preposition with the noun phrase immediately following it, giving the full chunked output:
[NP The quick brown fox] [VP jumps] [PP over [NP the lazy dog]]
Notice what this output does not contain: there's no single tree connecting the whole sentence together, no marked subject-verb-object relationship, and no indication of how the PP attaches to the rest of the sentence beyond sitting after the VP — shallow parsing stops at flat, non-overlapping chunks, which is exactly what makes it fast enough for real-time use while still extracting the pieces most NLP tasks actually need (the noun phrases for named-entity and information-extraction tasks, the verb phrase for identifying the action).
The Specific Ambiguity Shallow Parsing Cannot Resolve
"I saw the man with the telescope" is a textbook case of prepositional-phrase (PP) attachment ambiguity: the phrase with the telescope can attach to the man (describing a man who is carrying a telescope) or to saw (describing how the seeing was done — using a telescope), and the sentence is genuinely ambiguous between these two readings without more context. A shallow parser applied to this sentence would produce [NP the man] [PP with the telescope] as two separate flat chunks, and stop there — it has no mechanism for deciding which earlier constituent the PP attaches to, because answering that question requires building the kind of full attachment tree that a deep parser constructs and shallow parsing deliberately skips in exchange for speed. This is the concrete trade-off behind "shallow parsing balances speed and accuracy": the speed comes specifically from not resolving exactly this kind of attachment ambiguity.
Where the Techniques Behind Shallow Parsing Fit Together
Part-of-speech tagging (assigning DT, JJ, NN, and so on to each word) is the prerequisite step every chunking rule above depends on — without it, there's no tag sequence to match a pattern like DT JJ* NN against in the first place. It can be done with hand-written rules, statistical sequence models (Hidden Markov Models, Conditional Random Fields), or modern deep-learning taggers, all producing the same kind of tagged output the chunking rules above consume. Named Entity Recognition, which identifies that a noun phrase specifically names a person, place, or organization, builds directly on the same chunked noun phrases — it's a further classification step applied to spans shallow parsing has already identified, not a separate parsing stage from scratch.