Linguistic basics are the grammatical categories that syntax notation assumes you already know. Symbols such as S, NP, VP and Det are not new machine learning ideas, they are ordinary school grammar written in shorthand. This note defines them once so the parsing and grammar notes stay readable.
There are 2 levels of structure, and mixing them up is the usual reason the notation feels foreign:
- word classes, which label a single word
- phrases, which label a group of words acting as one unit
Level 1: word classes
A word class is the grammatical role of one word on its own. These are the same categories produced by POS tagging, so the labels below are the coarse pos_ tags from spaCy.
| Class | spaCy tag | What it does | Examples |
|---|---|---|---|
| Noun | NOUN | names a thing, person, place or idea | dog, flight, course |
| Proper noun | PROPN | names 1 specific entity | Singapore, Supraja |
| Pronoun | PRON | stands in for a noun already known | I, it, she |
| Verb | VERB | names an action or a state | chased, want, sleep |
| Auxiliary | AUX | helper verb that supports the main verb | is, was, have, will |
| Determiner | DET | fixes which noun you mean, and sits before that noun | the, a, this, my |
| Adjective | ADJ | describes a noun | morning, red, early |
| Adverb | ADV | describes a verb | quickly, yesterday |
| Preposition | ADP | shows a relation in place, time or direction | in, from, on |
| Conjunction | CCONJ | joins 2 parts of equal weight | and, or, but |
- the determiner is the class that trips people up, because English forces "the dog" or "a dog" rather than "dog" on its own
- a determiner is not an adjective, since "the big dog" is valid while "big the dog" is not, so the determiner holds a fixed slot at the front
Level 2: phrases and heads
A phrase is a group of words that behaves as 1 unit. Every phrase is named after its most important word, which is called the head.
| Phrase | Full name | Head word | Example |
|---|---|---|---|
NP | noun phrase | a noun | the angry dog |
VP | verb phrase | a verb | chased the cat |
PP | prepositional phrase | a preposition | in the morning |
S | sentence | the whole unit | the dog slept |
- the letter before the
Pnames the head, so the naming scheme carries no hidden meaning Sis the sentence, and in a grammar it is also the start symbol that every derivation begins from
The substitution test
Deciding what counts as a phrase does not need intuition, because there is a mechanical test. If a group of words can be replaced by 1 single word and the sentence still works, that group is a real phrase, also called a constituent.
| Sentence | Replacement | Verdict |
|---|---|---|
| the angry dog chased the cat | it chased the cat | "the angry dog" is an NP |
| the dog chased the cat | the dog slept | "chased the cat" is a VP |
| the flight left in the morning | the flight left then | "in the morning" is a PP |
| the dog chased the cat | no single word for "dog chased" | not a constituent |
Why the test matters
The grammar splits a sentence as
NP VPand never asNP N VplusNP, because only the first split produces groups that survive substitution. The rules of a grammar are built out of constituents.
Why a sentence splits into NP and VP
An English sentence names something, then says something about it. The part that names is the NP and is called the subject. The part that comments is the VP. That single fact is the whole meaning of the rule S -> NP VP.
the dog chased the cat
[ NP ] [ VP ]
who? what about him?
A VP can hold another NP inside it, because a verb such as "chased" needs something to chase. That inner NP is the object, which is what the rule VP -> V NP describes.
NP against Nominal
Nominal is an extra layer used in this grammar, and it is the noun plus its modifiers without the determiner.
a early morning flight
[Det] [ Nominal ]
[ NP ]
NP -> Det Nominalattaches the determiner exactly once, at the outsideNominal -> Nominal Nounis recursive, so it stacks "morning flight" then "early morning flight" without repeating the determiner- without the separate
Nominallayer, a recursive rule onNPwould allow the illegal string "a a morning flight"
One sentence drawn out
graph TD S["S"] --> NP1["NP"] S --> VP["VP"] NP1 --> D1["Det: the"] NP1 --> N1["N: dog"] VP --> V1["V: chased"] VP --> NP2["NP"] NP2 --> D2["Det: the"] NP2 --> N2["N: cat"]
- reading the tree downward from
Sis generation, which is what a grammar defines - reading the tree upward from the words is parsing, which is what a shift-reduce parser performs
Cheat sheet
| Symbol | Read it as | Made of |
|---|---|---|
S | sentence | NP VP |
NP | noun phrase | Det N, Det Nominal, Pronoun |
Nominal | noun with modifiers | Noun, Nominal Noun |
VP | verb phrase | V, V NP, V NP PP, V PP |
PP | prepositional phrase | Preposition NP |
Det | determiner | the words the, a, this |
N, V | single noun, verb | the words themselves |
- capitalised category names are non-terminals, so each one must expand further
- actual words are terminals, so they are the leaves and nothing expands out of them