A Brief Introduction to Semantics CMSC 473/673 UMBC
Outline Recap: dependency grammars and arc-standard dependency parsing Meaning from Syntax Structured Meaning: Semantic Frames and Roles What problem do they solve? Theory Computational resources: FrameNet, VerbNet, Propbank Computational Task: Semantic Role Labeling Selectional Restrictions What problem do they solve? Computational resources: WordNet Some simple approaches
Labeled Dependencies Word-to-word labeled relations nsubj gov ernor (head) Chris ate dep endent Constituency trees/analyses (PCFGs): based on hierarchical structure Dependency analyses: based on word relations
(Labeled) Dependency Parse Directed graphs Vertices: linguistic blobs in a sentence Edges: (labeled) arcs Often directed trees 1. A single root node with no incoming arcs 2. Each vertex except root has exactly one incoming arc 3. Unique path from the root node to each vertex
Are CFGs for Naught? Nope! Simple algorithm from ate S Xia and Palmer (2011) ate VP 1. Mark the head child of each node in a phrase structure, using ate spoon VP PP “appropriate” head rules. 2. In the dependency caviar spoon NP NP structure, make the head of each non-head child depend on the head of NP V D N P D N the head-child. Papa ate the caviar with a spoon
Shift-Reduce Dependency Parsing Tools: input words, some special root symbol ($), and a stack to hold configurations decide how ? Search problem! Shift: – move tokens onto the stack – decide if top two elements of the stack form a valid (good) grammatical dependency what are the what is valid? possible actions? Learn it! Reduce: – If there’s a valid relation, place head on the stack
Arc Standard Parsing state {[root], [words], [] } while state ≠ {[root], [], [ (deps) ]} { t ← ORACLE( state) state ← APPLY(t, state) Action } Possibility Action Meaning Name Assign the current word Assert a head-dependent relation between the word at as the head of some L EFT A RC the top of stack and the word directly beneath it; remove previously seen word the lower word from the stack Assign some previously Assert a head-dependent relation between the second return state seen word as the head of R IGHT A RC word on the stack and the word at the top; remove the the current word word at the top of the stack Wait processing the Remove the word from the front of the input buffer and current word; add it for S HIFT push it onto the stack later
Arc Standard Parsing state {[root], [words], [] } Q: What is the time complexity? while state ≠ {[root], [], [ (deps) ]} { A : Linear t ← ORACLE( state) state ← APPLY(t, state) Q: What’s potentially } problematic? return state A : This is a greedy algorithm
Learning An Oracle (Predictor) Training data: dependency treebank Input: configuration Output: {L EFT A RC , R IGHT A RC , S HIFT } t ← ORACLE(state) • Choose L EFT A RC if it produces a correct head-dependent relation given the reference parse and the current configuration • Choose R IGHT A RC if • it produces a correct head-dependent relation given the reference parse and • all of the dependents of the word at the top of the stack have already been assigned • Otherwise, choose S HIFT
Training the Predictor Predict action t give configuration s t = φ (s) Extract features of the configuration Examples: word forms, lemmas, POS, morphological features How? Perceptron, Maxent, Support Vector Machines, Multilayer Perceptrons, Neural Networks Take CMSC 478 (678) to learn more about these
Semantics Represent the “ meaning ” of an utterance Papa ate the caviar with a spoon. What does this mean ?
Some Approaches for Representing Meaning 1. Extract it directly from syntax ➔ Open Information Extraction 2. Add interpretation rules to syntax, and extract meaning from them ➔ Logical form parsing; CCG parsing 3. Create new tree-/graph-like semantic parses ➔ Semantic role labeling; {FrameNet, PropBank, VerbNet} parsing 4. Develop/obtain lexical resources and use them to represent semantic features of things ➔ Leverage WordNet; Selectional preferences
Outline Recap: dependency grammars and arc-standard dependency parsing Meaning from Syntax Structured Meaning: Semantic Frames and Roles What problem do they solve? Theory Computational resources: FrameNet, VerbNet, Propbank Computational Task: Semantic Role Labeling Selectional Restrictions What problem do they solve? Computational resources: WordNet Some simple approaches
From Dependencies to Shallow Semantics Core idea: a syntactic parse already encodes some amount of meaning “Papa” is the subject “the caviar” is the object …
From Syntax to Shallow Semantics “Open Information Extraction” Angeli et al. (2015)
From Syntax to Shallow Semantics “Open Information Extraction” Angeli et al. (2015) http://corenlp.run/ (constituency & dependency) https://github.com/hltcoe/predpatt a sampling of efforts http://openie.allenai.org/ http://www.cs.rochester.edu/research/knext/browse/ (constituency trees) http://rtw.ml.cmu.edu/rtw/
Logical Forms of Sentences “Papa ate the caviar” Core idea: find a (first order) logical form that corresponds to the sentence and evaluates to TRUE (Or instantiated….) ∃𝑓 Eating 𝑓 ∧ Agent 𝑓, Papa ∧ Theme(𝑓, caviar)
Logical Forms of Sentences “Papa ate the caviar” Core idea: find a (first order) This means logical form that assigning/learning a (partial) corresponds to the sentence logical form for each word and evaluates to TRUE (Or instantiated….) ∃𝑓 Eating 𝑓 ∧ Agent 𝑓, Papa ∧ Theme(𝑓, caviar)
Get Logical Forms from Parses ate S ate VP Papa ate the caviar NP NP V D N Papa ate the caviar
Get Logical Forms from Parses Logical form ate S of ate ate VP Papa ate the caviar NP NP V D N Papa ate the caviar
Get Logical Forms from Parses ate S ate VP Papa ate the caviar NP NP V D N Papa ate the caviar
Get Logical Forms from Parses ∃𝑓 Eating 𝑓 ∧ Agent 𝑓, Papa ∧ Theme(𝑓, caviar) ate S ate VP Papa ate the caviar NP NP V D N Papa ate the caviar
Outline Recap: dependency grammars and arc-standard dependency parsing Meaning from Syntax Structured Meaning: Semantic Frames and Roles What problem do they solve? Theory Computational resources: FrameNet, VerbNet, Propbank Computational Task: Semantic Role Labeling Selectional Restrictions What problem do they solve? Computational resources: WordNet Some simple approaches
Semantic Roles Who did what to whom at where ? The police officer detained the suspect at the scene of the crime V ARG2 ARG0 AM-loc Agent Predicate Theme Location Following slides adapted from SLP3
Predicate Alternations XYZ corporation bought the stock. They sold the stock to XYZ corporation. The stock was bought by XYZ corporation. The purchase of the stock by XYZ corporation... The stock purchase by XYZ corporation...
A Shallow Semantic Representation: Semantic Roles Predicates (bought, sold, purchase) represent a situation Semantic (thematic) roles express the abstract role that arguments of a predicate can take in the event Different schemes/annotation styles have different specificities More specific More general agent buyer proto-agent These terms are labels different annotation schemes might use
Thematic roles Sasha broke the window Pat opened the door Subjects of break and open: Breaker and Opener Specific to each event
Thematic roles Sasha broke the window Breaker and Opener have something in common! Volitional actors Pat opened the door Often animate Direct causal responsibility for their events Subjects of break and open: Breaker and Opener Thematic roles are a way to capture this semantic commonality between Breakers Specific to each event and Eaters .
Thematic roles Sasha broke the window Breaker and Opener have something in common! Volitional actors Pat opened the door Often animate Direct causal responsibility for their events Subjects of break and open: Breaker and Opener Thematic roles are a way to capture this semantic commonality between Breakers and Eaters . Specific to each event They are both AGENTS . The BrokenThing and OpenedThing , are THEMES . prototypically inanimate objects affected in some way by the action
Thematic roles Breaker and Opener have something in common! Sasha broke the window Volitional actors Often animate Pat opened the door Direct causal responsibility for their events Thematic roles are a way to capture this semantic Subjects of break and open: Breaker and commonality between Breakers and Eaters . Opener They are both AGENTS . Specific to each event The BrokenThing and OpenedThing , are THEMES . prototypically inanimate objects affected in some way by the action Modern formulation from Fillmore (1966, 1968), Gruber (1965) Fillmore influenced by Lucien Tesnière’s (1959) Êléments de Syntaxe Structurale, the book that introduced dependency grammar
“Standard” Thematic Roles
Thematic Roles Help Capture Verb Alternations (Diathesis Alternations) Break: AGENT, INSTRUMENT, or THEME as subject Give: THEME and GOAL in either order
Recommend
More recommend