Constituency Parsing Flashcards
Constituency Parsing
Constituency Parsing
- Parsing based on syntax, structure of the sentence
- Tree-structured: syntactic analysis of sentences (focus on structure, POS)
- Common Things: noun phrases, verb phrases, prepositional phrases
- Doesn’t work for all languages
Constituency Parsing
Constituency Parsing: Challenges
- PP (Prepositional Phrase) attachment
- Modifier Scope
- Complement Structure
- Coordination Scope
Constituency Parsing: Challenges
PP (Prepositional Phrase) Attachment
Different parsings of a sentence can be incorrect/produce wrong meaning
Constituency Parsing: Challenges
Modifier Scope
Modifier describes an object.
Ex: “plastic cup holder” (does plastic describe the cup or the holder?)
Constituency Parsing: Challenges
Complement Structure
Complementary tokens can refer to different objects.
Ex: “The students complained to the professor that they didn’t understand.” (“they” can refer to the professor or the students)
Constituency Parsing: Challenges
Coordination Scope
Some tokens can be classified using multiple labels
Ex: “The man picked up the hammer and saw.” (“saw” can be a verb or a noun)
Context-Free Grammars
Context-Free Grammars (CFG)
- Symbols that can be rewritten as one or more symbols
- Represented as a tuple
- Can have ambiguity (multiple results possible)
Context-Free Grammars
CFG Lexicon
Consists of “preterminals” (POS tags) rewriting as terminals (words)
Context-Free Grammars
CFG Representation
Written as a tuple: (N, T, S, R)
N = nonterminals
T = terminals
S = start symbol
R = rules
PCFGs
Probabalistic Context-Free Grammars
- Probabilites associated with rewrites
- Normalize by source symbol
PCFGs
PCFG Equation
P(T) = product_rET (r|parent(r))
Tree T is the series of rule applications
PCFGs
Learning a PCFG
- Given a set of example trees, the underlying CFG can simply be all production rules seen in the corpus
- Learning Goal: estimate the probability of each production rule
- Maximum Liklihood Estimation
PCFGs
PCFG Maximum Likelihood Estimation
P(a->b) = count(a->b) / count(a)
(similar to HMMs)
PCFGs
Chomsky Normal Form (CNF)
- To parse efficiently, we binarize PCFGs by always using Chomsky Normal Form
- Means that trees can only have either two non-terminal subtree children or one (terminal) leaf value
Inference
CKY
- Find argmax_T( P(T) )
- Dynamic Programming: chart maintains the best way of building symbol X over span(i, j)
- Like Viterbi
- Basically… continously split text and assign label until reach terminal