Natural Language Processing Syntax
Joakim Nivre
Uppsala University Department of Linguistics and Philology joakim.nivre@lingfil.uu.se
Natural Language Processing 1(7) What is Syntax?
! Words do not occur in isolation – they combine into sentences Snoopy hugs Woodstock Woodstock hugs Snoopy Snoopy hugs birds *Birds hugs Snoopy Birds hug Snoopy Snoopy hugs them *Them hug Snoopy They hug Snoopy
! Syntax – the study of sentence structure
Natural Language Processing 2(7) Two Views of Syntax
! Dependency: ! Syntactic structure resides in relations between words ! Focus on the functional roles (subject, object,...) ! Long tradition in descriptive grammar going back to Antiquity ! Constituency: ! Syntactic structure consists in the composition of phrases ! Focus on structural categories (noun phrase, verb phrase,...) ! Introduced in structural linguistics in the 20th century
Natural Language Processing 3(7) Dependency
! Syntactic structure represented by dependency trees ! Words represented by tree nodes ! Dependencies represented by directed arcs between nodes ! Functional roles specified by arc labels
punct
obj pobj amod subj amod pmod amod
Economic news had little effect on financial markets . ADJ NOUN VERB ADJ NOUN ADP ADJ NOUN PUNCT
Natural Language Processing 4(7) Constituency
! Syntactic structure represented by phrase structure trees ! Words represented by terminal tree nodes (leaves) ! Phrases represented by internal tree nodes ! Phrase types specified by node labels ! Phrase structure trees can be defined by context-free grammars
S ✑✑◗◗ ✑ ◗ ✑ ◗ ✑ VP❍ ◗ ✑ ❍ ◗ ✑ NP ◗ ✑ ✧❍ ◗ ✑ ✧ ❍ ◗ ✑ ✧ ◗ ✑ ✧ PP ◗ ✑ ✧ ❍❍ ◗ NP NP NP Punct ✟✟❍❍ ✟✟❍❍ ✟✟❍❍ Adj Noun Verb Adj Noun Prep Adj Noun
Economic news had little effect on financial markets .
Natural Language Processing 5(7) Two Complementary Views?
! Dependency trees explicitly represent ! dependency relations (directed arcs) ! functional categories (arc labels) ! possibly some structural categories (parts-of-speech) ! Phrase structure trees explicitly represent ! phrases (internal nodes) ! structural categories (node labels) ! possibly some functional categories (grammatical functions)
! Both are widely used in NLP – and hybrid representations exist
Natural Language Processing 6(7) Quiz
! True or false? 1. Syntax studies the internal structure or words 2. Syntax studies the order of words in sentences 3. Dependency trees show how words are related in sentences 4. Dependency trees show how sentences are composed of phrases
Natural Language Processing 7(7) Natural Language Processing Dependency
Joakim Nivre
Uppsala University Department of Linguistics and Philology joakim.nivre@lingfil.uu.se
Natural Language Processing 1(9) Dependency
! Syntactic structure consists of words,relatedbybinary, asymmetric relations called dependencies
Economic news had little effect on financial markets . ADJ NOUN VERB ADJ NOUN ADP ADJ NOUN PUNCT
Natural Language Processing 2(9) Dependency
! Syntactic structure consists of words,relatedbybinary, asymmetric relations called dependencies
Economic news had little effect on financial markets . ADJ NOUN VERB ADJ NOUN ADP ADJ NOUN PUNCT
Natural Language Processing 2(9) Dependency
! Syntactic structure consists of words,relatedbybinary, asymmetric relations called dependencies
Economic news had little effect on financial markets . ADJ NOUN VERB ADJ NOUN ADP ADJ NOUN PUNCT
Natural Language Processing 2(9) Dependency
! Syntactic structure consists of words,relatedbybinary, asymmetric relations called dependencies
Economic news had little effect on financial markets . ADJ NOUN VERB ADJ NOUN ADP ADJ NOUN PUNCT
Natural Language Processing 2(9) Dependency
! Syntactic structure consists of words,relatedbybinary, asymmetric relations called dependencies
Economic news had little effect on financial markets . ADJ NOUN VERB ADJ NOUN ADP ADJ NOUN PUNCT
Natural Language Processing 2(9) Dependency
! Syntactic structure consists of words,relatedbybinary, asymmetric relations called dependencies
Economic news had little effect on financial markets . ADJ NOUN VERB ADJ NOUN ADP ADJ NOUN PUNCT
Natural Language Processing 2(9) Dependency
! Syntactic structure consists of words,relatedbybinary, asymmetric relations called dependencies
p
obj pobj amod subj amod pmod amod
Economic news had little effect on financial markets . ADJ NOUN VERB ADJ NOUN ADP ADJ NOUN PUNCT
Natural Language Processing 2(9) Terminology
Higher Lower Head Dependent Governor Modifier Regent Subordinate . . . .
Natural Language Processing 3(9) Terminology
Higher Lower Head Dependent Governor Modifier Regent Subordinate . . . .
Natural Language Processing 3(9) Criteria for Heads and Dependents
! Criteria for a syntactic relation between a head H and a dependent D in a construction C: 1. H determines the syntactic category of C; H can replace C. 2. H determines the semantic category of C; D specifies H. 3. H is obligatory; D may be optional. 4. H selects D and determines whether D is obligatory. 5. The form of D depends on H (agreement or government). 6. The linear position of D is specified with reference to H. ! Issues: ! Syntactic (and morphological) versus semantic criteria ! Exocentric versus endocentric constructions
Natural Language Processing 4(9) Some Clear Cases
Construction Head Dependent Exocentric Verb Subject (subj) Verb Object (obj) Endocentric Verb Adverbial (advmod) Noun Attribute (amod)
Economic news suddenly affected financial markets . ADJ NOUN ADV VERB ADJ NOUN PUNCT
Natural Language Processing 5(9) Some Clear Cases
Construction Head Dependent Exocentric Verb Subject (subj) Verb Object (obj) Endocentric Verb Adverbial (advmod) Noun Attribute (amod)
subj
Economic news suddenly affected financial markets . ADJ NOUN ADV VERB ADJ NOUN PUNCT
Natural Language Processing 5(9) Some Clear Cases
Construction Head Dependent Exocentric Verb Subject (subj) Verb Object (obj) Endocentric Verb Adverbial (advmod) Noun Attribute (amod)
subj obj
Economic news suddenly affected financial markets . ADJ NOUN ADV VERB ADJ NOUN PUNCT
Natural Language Processing 5(9) Some Clear Cases
Construction Head Dependent Exocentric Verb Subject (subj) Verb Object (obj) Endocentric Verb Adverbial (advmod) Noun Attribute (amod)
subj obj advmod
Economic news suddenly affected financial markets . ADJ NOUN ADV VERB ADJ NOUN PUNCT
Natural Language Processing 5(9) Some Clear Cases
Construction Head Dependent Exocentric Verb Subject (subj) Verb Object (obj) Endocentric Verb Adverbial (advmod) Noun Attribute (amod)
subj obj amod advmod amod
Economic news suddenly affected financial markets . ADJ NOUN ADV VERB ADJ NOUN PUNCT
Natural Language Processing 5(9) Some Tricky Cases
! Complex verb groups (auxiliary main verb) ↔ ! Subordinate clauses (complementizer verb) ↔ ! Coordination (coordinator conjuncts) ↔ ! Prepositional phrases (preposition nominal) ↔ ! Punctuation
I can see that they rely on this and that . PRON AUX VERB SCONJ PRON VERB ADP PRON CONJ PRON PUNCT
Natural Language Processing 6(9) Some Tricky Cases
! Complex verb groups (auxiliary main verb) ↔ ! Subordinate clauses (complementizer verb) ↔ ! Coordination (coordinator conjuncts) ↔ ! Prepositional phrases (preposition nominal) ↔ ! Punctuation
subj ccomp
I can see that they rely on this and that . PRON AUX VERB SCONJ PRON VERB ADP PRON CONJ PRON PUNCT
Natural Language Processing 6(9) Some Tricky Cases
! Complex verb groups (auxiliary main verb) ↔ ! Subordinate clauses (complementizer verb) ↔ ! Coordination (coordinator conjuncts) ↔ ! Prepositional phrases (preposition nominal) ↔ ! Punctuation
subj ccomp
I can see that they rely on this and that . PRON AUX VERB SCONJ PRON VERB ADP PRON CONJ PRON PUNCT
Natural Language Processing 6(9) Some Tricky Cases
! Complex verb groups (auxiliary main verb) ↔ ! Subordinate clauses (complementizer verb) ↔ ! Coordination (coordinator conjuncts) ↔ ! Prepositional phrases (preposition nominal) ↔ ! Punctuation
I can see that they rely on this and that . PRON AUX VERB SCONJ PRON VERB ADP PRON CONJ PRON PUNCT
Natural Language Processing 6(9) Some Tricky Cases
! Complex verb groups (auxiliary main verb) ↔ ! Subordinate clauses (complementizer verb) ↔ ! Coordination (coordinator conjuncts) ↔ ! Prepositional phrases (preposition nominal) ↔ ! Punctuation
I can see that they rely on this and that . PRON AUX VERB SCONJ PRON VERB ADP PRON CONJ PRON PUNCT
Natural Language Processing 6(9) Some Tricky Cases
! Complex verb groups (auxiliary main verb) ↔ ! Subordinate clauses (complementizer verb) ↔ ! Coordination (coordinator conjuncts) ↔ ! Prepositional phrases (preposition nominal) ↔ ! Punctuation
I can see that they rely on this and that . PRON AUX VERB SCONJ PRON VERB ADP PRON CONJ PRON PUNCT
Natural Language Processing 6(9) Treebanks
! Treebanks ! Syntactically annotated corpora are called treebanks ! Treebanks can be used to train and evaluate syntactic parsers ! Dependency treebanks ! Treebanks with dependency-based annotation ! Example: Prague Dependency Treebank of Czech ! Annotation schemes can vary considerably across languages
Natural Language Processing 7(9) Universal Dependencies (UD)
! Standardized framework for dependency annotation ! Consistent analysis across typologically different languages
obl
obj case det nsubj det det
DET NOUN VERB DET NOUN ADP DET NOUN the dog chased the cat from the room koira jahtasi kissan huoneesta NOUN VERB NOUN NOUN Case=Nom Case=Acc Case=Ela
nsubj obj obl
Natural Language Processing 8(9) Quiz
The big bear scared the little dog.
! True or false 1. The word dog is a dependent of the word bear 2. The word bear is a dependent of the word scared 3. The word scared is a dependent of the word little 4. The word little is a dependent of the word dog
Natural Language Processing 9(9) Natural Language Processing Constituency
Joakim Nivre
Uppsala University Department of Linguistics and Philology joakim.nivre@lingfil.uu.se
Natural Language Processing 1(11) Constituency
! Word groups can act as single units Los Angeles a high-class spot such as Mindy’s three parties from Brooklyn they
! Such groups of words are called constituents ! Constituents have similar internal structure and behavior
Natural Language Processing 2(11) The girl in the corner + wears a yellow hat and dark sunglasses. [The girl + in the corner] [wears + a yellow hat and dark sunglasses]. [The + girl] [in + the corner] wears [a yellow hat + and + dark sunglasses]. The girl in [the + corner] wears [a + yellow hat] and [dark + sunglasses]. The girl in the corner wears a [yellow + hat] and dark sunglasses.
Immediate Constituency Analysis
! We can find constituents by recursive decomposition:
The girl in the corner wears a yellow hat and dark sunglasses.
Natural Language Processing 3(11) [The girl + in the corner] [wears + a yellow hat and dark sunglasses]. [The + girl] [in + the corner] wears [a yellow hat + and + dark sunglasses]. The girl in [the + corner] wears [a + yellow hat] and [dark + sunglasses]. The girl in the corner wears a [yellow + hat] and dark sunglasses.
Immediate Constituency Analysis
! We can find constituents by recursive decomposition:
The girl in the corner wears a yellow hat and dark sunglasses. The girl in the corner + wears a yellow hat and dark sunglasses.
Natural Language Processing 3(11) [The + girl] [in + the corner] wears [a yellow hat + and + dark sunglasses]. The girl in [the + corner] wears [a + yellow hat] and [dark + sunglasses]. The girl in the corner wears a [yellow + hat] and dark sunglasses.
Immediate Constituency Analysis
! We can find constituents by recursive decomposition:
The girl in the corner wears a yellow hat and dark sunglasses. The girl in the corner + wears a yellow hat and dark sunglasses. [The girl + in the corner] [wears + a yellow hat and dark sunglasses].
Natural Language Processing 3(11) The girl in [the + corner] wears [a + yellow hat] and [dark + sunglasses]. The girl in the corner wears a [yellow + hat] and dark sunglasses.
Immediate Constituency Analysis
! We can find constituents by recursive decomposition:
The girl in the corner wears a yellow hat and dark sunglasses. The girl in the corner + wears a yellow hat and dark sunglasses. [The girl + in the corner] [wears + a yellow hat and dark sunglasses]. [The + girl] [in + the corner] wears [a yellow hat + and + dark sunglasses].
Natural Language Processing 3(11) The girl in the corner wears a [yellow + hat] and dark sunglasses.
Immediate Constituency Analysis
! We can find constituents by recursive decomposition:
The girl in the corner wears a yellow hat and dark sunglasses. The girl in the corner + wears a yellow hat and dark sunglasses. [The girl + in the corner] [wears + a yellow hat and dark sunglasses]. [The + girl] [in + the corner] wears [a yellow hat + and + dark sunglasses]. The girl in [the + corner] wears [a + yellow hat] and [dark + sunglasses].
Natural Language Processing 3(11) Immediate Constituency Analysis
! We can find constituents by recursive decomposition:
The girl in the corner wears a yellow hat and dark sunglasses. The girl in the corner + wears a yellow hat and dark sunglasses. [The girl + in the corner] [wears + a yellow hat and dark sunglasses]. [The + girl] [in + the corner] wears [a yellow hat + and + dark sunglasses]. The girl in [the + corner] wears [a + yellow hat] and [dark + sunglasses]. The girl in the corner wears a [yellow + hat] and dark sunglasses.
Natural Language Processing 3(11) Test for Constituents
! Substitution: similar constituents can replace each other The girl in the corner wears a yellow hat and dark sunglasses The girl wears a yellow hat and dark sunglasses She wears a yellow hat and dark sunglasses *In the corner wears a yellow hat and dark sunglasses ! Movement: words in a constituent move together She went to Paris on Monday. On Monday she went to Paris. *Paris on Monday she went to. *On she went to Paris Monday.
Natural Language Processing 4(11) Constituent Types
! Noun phrase (NP) she the house Robin Hood and his merry men ! Verb phrase (VP) blushed loves Mary was told to sit down and be quiet ! Prepositional phrase (PP) on it with the telescope through the foggy dew
Natural Language Processing 5(11) Context-Free Grammar
! Acontext-freegrammar(CFG)consistsof ! a finite set of nonterminal symbols ! a finite set of terminal symbols ! a distinguished nonterminal symbol S (for Start) ! a finite set of rules of the form
A α → where A is a nonterminal and α is a (possibly empty) sequence of nonterminal and terminal symbols
Natural Language Processing 6(11) Grammar Lexicon
Example Grammar
S NP VP Punct Verb had → → VP VP PP Noun news → → VP Verb NP Noun effect → → NP NP PP Noun markets → → NP Adj Noun Adj Economic → → PP Prep NP Adj little → → Adj financial → Prep on → Punct . →
Natural Language Processing 7(11) Example Grammar
Grammar Lexicon S NP VP Punct Verb had → → VP VP PP Noun news → → VP Verb NP Noun effect → → NP NP PP Noun markets → → NP Adj Noun Adj Economic → → PP Prep NP Adj little → → Adj financial → Prep on → Punct . →
Natural Language Processing 7(11) NP VP Punct Adj Noun VP Punct Economic Noun VP Punct Economic news VP Punct Economic news Verb NP Punct Economic news had NP Punct Economic news had NP PP Punct Economic news had Adj Noun PP Punct Economic news had little Noun PP Punct Economic news had little effect PP Punct Economic news had little effect Prep NP Punct Economic news had little effect on NP Punct Economic news had little effect on Adj Noun Punct Economic news had little effect on financial Noun Punct Economic news had little effect on financial markets Punct Economic news had little effect on financial markets .
Derivations
S
Natural Language Processing 8(11) Adj Noun VP Punct Economic Noun VP Punct Economic news VP Punct Economic news Verb NP Punct Economic news had NP Punct Economic news had NP PP Punct Economic news had Adj Noun PP Punct Economic news had little Noun PP Punct Economic news had little effect PP Punct Economic news had little effect Prep NP Punct Economic news had little effect on NP Punct Economic news had little effect on Adj Noun Punct Economic news had little effect on financial Noun Punct Economic news had little effect on financial markets Punct Economic news had little effect on financial markets .
Derivations
S NP VP Punct
Natural Language Processing 8(11) Economic Noun VP Punct Economic news VP Punct Economic news Verb NP Punct Economic news had NP Punct Economic news had NP PP Punct Economic news had Adj Noun PP Punct Economic news had little Noun PP Punct Economic news had little effect PP Punct Economic news had little effect Prep NP Punct Economic news had little effect on NP Punct Economic news had little effect on Adj Noun Punct Economic news had little effect on financial Noun Punct Economic news had little effect on financial markets Punct Economic news had little effect on financial markets .
Derivations
S NP VP Punct Adj Noun VP Punct
Natural Language Processing 8(11) Economic news VP Punct Economic news Verb NP Punct Economic news had NP Punct Economic news had NP PP Punct Economic news had Adj Noun PP Punct Economic news had little Noun PP Punct Economic news had little effect PP Punct Economic news had little effect Prep NP Punct Economic news had little effect on NP Punct Economic news had little effect on Adj Noun Punct Economic news had little effect on financial Noun Punct Economic news had little effect on financial markets Punct Economic news had little effect on financial markets .
Derivations
S NP VP Punct Adj Noun VP Punct Economic Noun VP Punct
Natural Language Processing 8(11) Economic news Verb NP Punct Economic news had NP Punct Economic news had NP PP Punct Economic news had Adj Noun PP Punct Economic news had little Noun PP Punct Economic news had little effect PP Punct Economic news had little effect Prep NP Punct Economic news had little effect on NP Punct Economic news had little effect on Adj Noun Punct Economic news had little effect on financial Noun Punct Economic news had little effect on financial markets Punct Economic news had little effect on financial markets .
Derivations
S NP VP Punct Adj Noun VP Punct Economic Noun VP Punct Economic news VP Punct
Natural Language Processing 8(11) Economic news had NP Punct Economic news had NP PP Punct Economic news had Adj Noun PP Punct Economic news had little Noun PP Punct Economic news had little effect PP Punct Economic news had little effect Prep NP Punct Economic news had little effect on NP Punct Economic news had little effect on Adj Noun Punct Economic news had little effect on financial Noun Punct Economic news had little effect on financial markets Punct Economic news had little effect on financial markets .
Derivations
S NP VP Punct Adj Noun VP Punct Economic Noun VP Punct Economic news VP Punct Economic news Verb NP Punct
Natural Language Processing 8(11) Economic news had NP PP Punct Economic news had Adj Noun PP Punct Economic news had little Noun PP Punct Economic news had little effect PP Punct Economic news had little effect Prep NP Punct Economic news had little effect on NP Punct Economic news had little effect on Adj Noun Punct Economic news had little effect on financial Noun Punct Economic news had little effect on financial markets Punct Economic news had little effect on financial markets .
Derivations
S NP VP Punct Adj Noun VP Punct Economic Noun VP Punct Economic news VP Punct Economic news Verb NP Punct Economic news had NP Punct
Natural Language Processing 8(11) Economic news had Adj Noun PP Punct Economic news had little Noun PP Punct Economic news had little effect PP Punct Economic news had little effect Prep NP Punct Economic news had little effect on NP Punct Economic news had little effect on Adj Noun Punct Economic news had little effect on financial Noun Punct Economic news had little effect on financial markets Punct Economic news had little effect on financial markets .
Derivations
S NP VP Punct Adj Noun VP Punct Economic Noun VP Punct Economic news VP Punct Economic news Verb NP Punct Economic news had NP Punct Economic news had NP PP Punct
Natural Language Processing 8(11) Economic news had little Noun PP Punct Economic news had little effect PP Punct Economic news had little effect Prep NP Punct Economic news had little effect on NP Punct Economic news had little effect on Adj Noun Punct Economic news had little effect on financial Noun Punct Economic news had little effect on financial markets Punct Economic news had little effect on financial markets .
Derivations
S NP VP Punct Adj Noun VP Punct Economic Noun VP Punct Economic news VP Punct Economic news Verb NP Punct Economic news had NP Punct Economic news had NP PP Punct Economic news had Adj Noun PP Punct
Natural Language Processing 8(11) Economic news had little effect PP Punct Economic news had little effect Prep NP Punct Economic news had little effect on NP Punct Economic news had little effect on Adj Noun Punct Economic news had little effect on financial Noun Punct Economic news had little effect on financial markets Punct Economic news had little effect on financial markets .
Derivations
S NP VP Punct Adj Noun VP Punct Economic Noun VP Punct Economic news VP Punct Economic news Verb NP Punct Economic news had NP Punct Economic news had NP PP Punct Economic news had Adj Noun PP Punct Economic news had little Noun PP Punct
Natural Language Processing 8(11) Economic news had little effect Prep NP Punct Economic news had little effect on NP Punct Economic news had little effect on Adj Noun Punct Economic news had little effect on financial Noun Punct Economic news had little effect on financial markets Punct Economic news had little effect on financial markets .
Derivations
S NP VP Punct Adj Noun VP Punct Economic Noun VP Punct Economic news VP Punct Economic news Verb NP Punct Economic news had NP Punct Economic news had NP PP Punct Economic news had Adj Noun PP Punct Economic news had little Noun PP Punct Economic news had little effect PP Punct
Natural Language Processing 8(11) Economic news had little effect on NP Punct Economic news had little effect on Adj Noun Punct Economic news had little effect on financial Noun Punct Economic news had little effect on financial markets Punct Economic news had little effect on financial markets .
Derivations
S NP VP Punct Adj Noun VP Punct Economic Noun VP Punct Economic news VP Punct Economic news Verb NP Punct Economic news had NP Punct Economic news had NP PP Punct Economic news had Adj Noun PP Punct Economic news had little Noun PP Punct Economic news had little effect PP Punct Economic news had little effect Prep NP Punct
Natural Language Processing 8(11) Economic news had little effect on Adj Noun Punct Economic news had little effect on financial Noun Punct Economic news had little effect on financial markets Punct Economic news had little effect on financial markets .
Derivations
S NP VP Punct Adj Noun VP Punct Economic Noun VP Punct Economic news VP Punct Economic news Verb NP Punct Economic news had NP Punct Economic news had NP PP Punct Economic news had Adj Noun PP Punct Economic news had little Noun PP Punct Economic news had little effect PP Punct Economic news had little effect Prep NP Punct Economic news had little effect on NP Punct
Natural Language Processing 8(11) Economic news had little effect on financial Noun Punct Economic news had little effect on financial markets Punct Economic news had little effect on financial markets .
Derivations
S NP VP Punct Adj Noun VP Punct Economic Noun VP Punct Economic news VP Punct Economic news Verb NP Punct Economic news had NP Punct Economic news had NP PP Punct Economic news had Adj Noun PP Punct Economic news had little Noun PP Punct Economic news had little effect PP Punct Economic news had little effect Prep NP Punct Economic news had little effect on NP Punct Economic news had little effect on Adj Noun Punct
Natural Language Processing 8(11) Economic news had little effect on financial markets Punct Economic news had little effect on financial markets .
Derivations
S NP VP Punct Adj Noun VP Punct Economic Noun VP Punct Economic news VP Punct Economic news Verb NP Punct Economic news had NP Punct Economic news had NP PP Punct Economic news had Adj Noun PP Punct Economic news had little Noun PP Punct Economic news had little effect PP Punct Economic news had little effect Prep NP Punct Economic news had little effect on NP Punct Economic news had little effect on Adj Noun Punct Economic news had little effect on financial Noun Punct
Natural Language Processing 8(11) Economic news had little effect on financial markets .
Derivations
S NP VP Punct Adj Noun VP Punct Economic Noun VP Punct Economic news VP Punct Economic news Verb NP Punct Economic news had NP Punct Economic news had NP PP Punct Economic news had Adj Noun PP Punct Economic news had little Noun PP Punct Economic news had little effect PP Punct Economic news had little effect Prep NP Punct Economic news had little effect on NP Punct Economic news had little effect on Adj Noun Punct Economic news had little effect on financial Noun Punct Economic news had little effect on financial markets Punct
Natural Language Processing 8(11) Derivations
S NP VP Punct Adj Noun VP Punct Economic Noun VP Punct Economic news VP Punct Economic news Verb NP Punct Economic news had NP Punct Economic news had NP PP Punct Economic news had Adj Noun PP Punct Economic news had little Noun PP Punct Economic news had little effect PP Punct Economic news had little effect Prep NP Punct Economic news had little effect on NP Punct Economic news had little effect on Adj Noun Punct Economic news had little effect on financial Noun Punct Economic news had little effect on financial markets Punct Economic news had little effect on financial markets .
Natural Language Processing 8(11) Phrase Structure Trees
S NP VP Punct Adj Noun VP Punct Economic Noun VP Punct Economic news VP Punct Economic news Verb NP Punct Economic news had NP Punct Economic news had NP PP Punct Economic news had Adj Noun PP Punct Economic news had little Noun PP Punct Economic news had little effect PP Punct Economic news had little effect Prep NP Punct Economic news had little effect on NP Punct S Economic news had little effect on Adj Noun Punct ✑◗ Economic news had little effect on financial Noun Punct ✑ ◗ Economic news had little effect on financial markets Punct ✑ ◗ Economic news had little effect on financial markets . ✑ ◗ ✑ VP ◗ ✑ ❍❍ ◗ ✑ NP ◗ ✑ ✧❍ ◗ ✑ ✧ ❍ ◗ ✑ ✧ ◗ ✑ ✧ PP ◗ ✑ ✧ ❍❍ ◗ NP NP NP Punct ✟✟❍❍ ✟✟❍❍ ✟✟❍❍ Adj Noun Verb Adj Noun Prep Adj Noun
Economic news had little effect on financial markets .
Natural Language Processing 9(11) Treebanks and Grammars
! Constituency treebanks ! Treebanks with constituency-based annotation ! Example: Penn Treebank of English ! Treebank grammars ! We can extract CFGs from constituency treebanks ! Treebank grammars can be used to build syntactic parsers
Natural Language Processing 10(11) Quiz
The big bear scared the little dog.
! True or false 1. The substring dog is a noun phrase 2. The substring little dog is a noun phrase 3. The substring the little dog is a noun phrase 4. The substring scared the little dog is a noun phrase 5. The substring scared the little dog is a verb phrase
Natural Language Processing 11(11) Natural Language Processing Universal Dependencies
Joakim Nivre
Uppsala University Department of Linguistics and Philology joakim.nivre@lingfil.uu.se
Natural Language Processing 1(13) Universal Dependencies (UD)
! Framework for multilingual grammatical annotation ! Morphological layer: ! Part-of-speech tags ! Morphological features ! Lemmas ! Syntactic layer: ! Dependency tree
Natural Language Processing 2(13) nsubj obj
Snoopy hugged Woodstock
obj nsubj iobj
Snoopy gave Woodstock food
Predicates and Arguments nsubj obj iobj
nsubj
Snoopy barked
Natural Language Processing 3(13) obj nsubj iobj
Snoopy gave Woodstock food
Predicates and Arguments nsubj obj iobj
nsubj nsubj obj
Snoopy barked Snoopy hugged Woodstock
Natural Language Processing 3(13) Predicates and Arguments nsubj obj iobj
nsubj nsubj obj
Snoopy barked Snoopy hugged Woodstock
obj nsubj iobj
Snoopy gave Woodstock food
Natural Language Processing 3(13) obl nsubj obj case
Snoopy hugged Woodstock in Paris
obl nsubj obj case
Snoopy gave food to Woodstock
Predicates and Modifiers advmod obl
nsubj advmod
Snoopy barked angrily
Natural Language Processing 4(13) obl nsubj obj case
Snoopy gave food to Woodstock
Predicates and Modifiers advmod obl
obl nsubj advmod nsubj obj case
Snoopy barked angrily Snoopy hugged Woodstock in Paris
Natural Language Processing 4(13) Predicates and Modifiers advmod obl
obl nsubj advmod nsubj obj case
Snoopy barked angrily Snoopy hugged Woodstock in Paris
obl nsubj obj case
Snoopy gave food to Woodstock
Natural Language Processing 4(13) nmod case
coffee with cream
nmod amod case
black coffee with cream
Noun Phrases amod nmod
amod
black coffee
Natural Language Processing 5(13) nmod amod case
black coffee with cream
Noun Phrases amod nmod
nmod amod case
black coffee coffee with cream
Natural Language Processing 5(13) Noun Phrases amod nmod
nmod amod case
black coffee coffee with cream
nmod amod case
black coffee with cream
Natural Language Processing 5(13) Quiz
Snoopy likes tasty bagels
! Which words are dependents of likes? 1. Snoopy 2. likes 3. tasty 4. bagels
Natural Language Processing 6(13) Quiz
Snoopy likes tasty bagels
! Which dependency relation does bagels have to its head? 1. nsubj 2. obj 3. obl 4. nmod
Natural Language Processing 7(13) nsubj aux obj
Snoopy will hug Woodstock
nsubj obl aux case aux det
Snoopy could have slept on the roof
Function Words aux case det
obj nsubj det
Snoopy hugged the bird
Natural Language Processing 8(13) nsubj obl aux case aux det
Snoopy could have slept on the roof
Function Words aux case det
obj nsubj nsubj det aux obj
Snoopy hugged the bird Snoopy will hug Woodstock
Natural Language Processing 8(13) Function Words aux case det
obj nsubj nsubj det aux obj
Snoopy hugged the bird Snoopy will hug Woodstock
nsubj obl aux case aux det
Snoopy could have slept on the roof
Natural Language Processing 8(13) xcomp nsubj mark obj
Snoopy promised to hug Woodstock
Subordinate Clauses ccomp xcomp mark ccomp mark nsubj nsubj aux obj
Snoopy promised that he would hug Woodstock
Natural Language Processing 9(13) Subordinate Clauses ccomp xcomp mark ccomp mark nsubj nsubj aux obj
Snoopy promised that he would hug Woodstock
xcomp nsubj mark obj
Snoopy promised to hug Woodstock
Natural Language Processing 9(13) acl acl obj det nsubj obj det nsubj
the bird who hugged Snoopy the bird who Snoopy hugged
Adverbial and Adnominal Clauses advcl acl advcl mark nsubj obj nsubj obj
Snoopy hugs Woodstock if Lucy hugs Linus
Natural Language Processing 10(13) acl obj det nsubj
the bird who Snoopy hugged
Adverbial and Adnominal Clauses advcl acl advcl mark nsubj obj nsubj obj
Snoopy hugs Woodstock if Lucy hugs Linus
acl det nsubj obj
the bird who hugged Snoopy
Natural Language Processing 10(13) Adverbial and Adnominal Clauses advcl acl advcl mark nsubj obj nsubj obj
Snoopy hugs Woodstock if Lucy hugs Linus
acl acl obj det nsubj obj det nsubj
the bird who hugged Snoopy the bird who Snoopy hugged
Natural Language Processing 10(13) Adverbial and Adnominal Clauses advcl acl advcl mark nsubj obj nsubj obj
Snoopy hugs Woodstock if Lucy hugs Linus
acl:relcl acl:relcl obj det nsubj obj det nsubj
the bird who hugged Snoopy the bird who Snoopy hugged
Natural Language Processing 10(13) punct
nsubj obj flat compound
Other Relations flat compound punct
nsubj obj
Charlie Brown ate a tuna bagel .
Natural Language Processing 11(13) punct
obj compound
Other Relations flat compound punct
nsubj flat
Charlie Brown ate a tuna bagel .
Natural Language Processing 11(13) punct
Other Relations flat compound punct
nsubj obj flat compound
Charlie Brown ate a tuna bagel .
Natural Language Processing 11(13) Other Relations flat compound punct
punct
nsubj obj flat compound
Charlie Brown ate a tuna bagel .
Natural Language Processing 11(13) Quiz
Snoopy could have tried to hug Woodstock
! Which verb is the root of the dependency tree? 1. could 2. have 3. tried 4. hug
Natural Language Processing 12(13) Quiz
Snoopy could have tried to hug Woodstock
! Which verbs have the dependency relation aux to its head? 1. could 2. have 3. tried 4. hug
Natural Language Processing 13(13)