13
1 Statistical NLP Spring 2011 Lecture 21: Semantic Roles Dan Klein – UC Berkeley Semantic Role Labeling (SRL) Characterize clauses as relations with roles: Want to more than which NP is the subject (but not much more): Relations like subject are syntactic, relations like agent or message are semantic Typical pipeline: Parse, then label roles Almost all errors locked in by parser Really, SRL is quite a lot easier than parsing

SP11 cs288 lecture 21 -- semantic roles (2PP)klein/cs288/sp11/slides/SP11 cs28… · Lecture 21: Semantic Roles Dan Klein – UC Berkeley Semantic Role Labeling (SRL) Characterize

  • Upload
    others

  • View
    7

  • Download
    0

Embed Size (px)

Citation preview

Page 1: SP11 cs288 lecture 21 -- semantic roles (2PP)klein/cs288/sp11/slides/SP11 cs28… · Lecture 21: Semantic Roles Dan Klein – UC Berkeley Semantic Role Labeling (SRL) Characterize

1

Statistical NLPSpring 2011

Lecture 21: Semantic RolesDan Klein – UC Berkeley

Semantic Role Labeling (SRL)

� Characterize clauses as relations with roles:

� Want to more than which NP is the subject (but not much more):� Relations like subject are syntactic, relations like agent or message

are semantic� Typical pipeline:

� Parse, then label roles� Almost all errors locked in by parser� Really, SRL is quite a lot easier than parsing

Page 2: SP11 cs288 lecture 21 -- semantic roles (2PP)klein/cs288/sp11/slides/SP11 cs28… · Lecture 21: Semantic Roles Dan Klein – UC Berkeley Semantic Role Labeling (SRL) Characterize

2

SRL Example

PropBank / FrameNet

� FrameNet: roles shared between verbs� PropBank: each verb has it’s own roles� PropBank more used, because it’s layered over the treebank (and

so has greater coverage, plus parses)� Note: some linguistic theories postulate even fewer roles than

FrameNet (e.g. 5-20 total: agent, patient, instrument, etc.)

Page 3: SP11 cs288 lecture 21 -- semantic roles (2PP)klein/cs288/sp11/slides/SP11 cs28… · Lecture 21: Semantic Roles Dan Klein – UC Berkeley Semantic Role Labeling (SRL) Characterize

3

PropBank Example

PropBank Example

Page 4: SP11 cs288 lecture 21 -- semantic roles (2PP)klein/cs288/sp11/slides/SP11 cs28… · Lecture 21: Semantic Roles Dan Klein – UC Berkeley Semantic Role Labeling (SRL) Characterize

4

PropBank Example

Shared Arguments

Page 5: SP11 cs288 lecture 21 -- semantic roles (2PP)klein/cs288/sp11/slides/SP11 cs28… · Lecture 21: Semantic Roles Dan Klein – UC Berkeley Semantic Role Labeling (SRL) Characterize

5

Path Features

Results

� Features:� Path from target to filler� Filler’s syntactic type, headword, case� Target’s identity� Sentence voice, etc.� Lots of other second-order features

� Gold vs parsed source trees

� SRL is fairly easy on gold trees

� Harder on automatic parses

Page 6: SP11 cs288 lecture 21 -- semantic roles (2PP)klein/cs288/sp11/slides/SP11 cs28… · Lecture 21: Semantic Roles Dan Klein – UC Berkeley Semantic Role Labeling (SRL) Characterize

6

Interaction with Empty Elements

Empty Elements

� In the PTB, three kinds of empty elements:� Null items (usually complementizers)� Dislocation (WH-traces, topicalization, relative

clause and heavy NP extraposition)� Control (raising, passives, control, shared

argumentation)

� Need to reconstruct these (and resolve any indexation)

Page 7: SP11 cs288 lecture 21 -- semantic roles (2PP)klein/cs288/sp11/slides/SP11 cs28… · Lecture 21: Semantic Roles Dan Klein – UC Berkeley Semantic Role Labeling (SRL) Characterize

7

Example: English

Example: German

Page 8: SP11 cs288 lecture 21 -- semantic roles (2PP)klein/cs288/sp11/slides/SP11 cs28… · Lecture 21: Semantic Roles Dan Klein – UC Berkeley Semantic Role Labeling (SRL) Characterize

8

Types of Empties

A Pattern-Matching Approach� [Johnson 02]

Page 9: SP11 cs288 lecture 21 -- semantic roles (2PP)klein/cs288/sp11/slides/SP11 cs28… · Lecture 21: Semantic Roles Dan Klein – UC Berkeley Semantic Role Labeling (SRL) Characterize

9

Pattern-Matching Details

� Something like transformation-based learning� Extract patterns

� Details: transitive verb marking, auxiliaries� Details: legal subtrees

� Rank patterns� Pruning ranking: by correct / match rate� Application priority: by depth

� Pre-order traversal� Greedy match

Top Patterns Extracted

Page 10: SP11 cs288 lecture 21 -- semantic roles (2PP)klein/cs288/sp11/slides/SP11 cs28… · Lecture 21: Semantic Roles Dan Klein – UC Berkeley Semantic Role Labeling (SRL) Characterize

10

Results

A Feature-Based Approach

� [Levy and Manning 04]� Build two classifiers:

� First one predicts where empties go� Second one predicts if/where they are bound� Use syntactic features similar to SRL (paths,

categories, heads, etc)

Page 11: SP11 cs288 lecture 21 -- semantic roles (2PP)klein/cs288/sp11/slides/SP11 cs28… · Lecture 21: Semantic Roles Dan Klein – UC Berkeley Semantic Role Labeling (SRL) Characterize

11

Semantic Interpretation

� Back to meaning!� A very basic approach to computational semantics� Truth-theoretic notion of semantics (Tarskian)� Assign a “meaning” to each word� Word meanings combine according to the parse structure� People can and do spend entire courses on this topic� We’ll spend about an hour!

� What’s NLP and what isn’t?� Designing meaning representations?� Computing those representations?� Reasoning with them?

� Supplemental reading will be on the web page.

Meaning

� “Meaning”� What is meaning?

� “The computer in the corner.”� “Bob likes Alice.”� “I think I am a gummi bear.”

� Knowing whether a statement is true?� Knowing the conditions under which it’s true?� Being able to react appropriately to it?

� “Who does Bob sit next to?”� “Close the door.”

� A distinction:� Linguistic (semantic) meaning

� “The door is open.”� Speaker (pragmatic) meaning

� Today: assembling the semantic meaning of sentence from its parts

Page 12: SP11 cs288 lecture 21 -- semantic roles (2PP)klein/cs288/sp11/slides/SP11 cs28… · Lecture 21: Semantic Roles Dan Klein – UC Berkeley Semantic Role Labeling (SRL) Characterize

12

Entailment and Presupposition

� Some notions worth knowing:� Entailment:

� A entails B if A being true necessarily implies B is true

� ? “Twitchy is a big mouse” → “Twitchy is a mouse”

� ? “Twitchy is a big mouse” → “Twitchy is big”

� ? “Twitchy is a big mouse” → “Twitchy is furry”

� Presupposition:� A presupposes B if A is only well-defined if B is true

� “The computer in the corner is broken” presupposes that there is a (salient) computer in the corner

Truth-Conditional Semantics

� Linguistic expressions:� “Bob sings”

� Logical translations:� sings(bob)� Could be p_1218(e_397)

� Denotation:� [[bob]] = some specific person (in some context)� [[sings(bob)]] = ???

� Types on translations:� bob : e (for entity)� sings(bob) : t (for truth-value)

S

NP

Bob

bob

VP

singsλy.sings(y)

sings(bob)

Page 13: SP11 cs288 lecture 21 -- semantic roles (2PP)klein/cs288/sp11/slides/SP11 cs28… · Lecture 21: Semantic Roles Dan Klein – UC Berkeley Semantic Role Labeling (SRL) Characterize

13

Truth-Conditional Semantics� Proper names:

� Refer directly to some entity in the world� Bob : bob [[bob]]W � ???

� Sentences:� Are either true or false (given

how the world actually is)� Bob sings : sings(bob)

� So what about verbs (and verb phrases)?� sings must combine with bob to produce sings(bob)� The λ-calculus is a notation for functions whose arguments are

not yet filled.� sings : λx.sings(x)� This is predicate – a function which takes an entity (type e) and

produces a truth value (type t). We can write its type as e→t.� Adjectives?

S

NP

Bob

bob

VP

singsλy.sings(y)

sings(bob)

Compositional Semantics� So now we have meanings for the words� How do we know how to combine words?� Associate a combination rule with each grammar rule:

� S : β(α) → NP : α VP : β (function application)

� VP : λx . α(x) ∧ β(x) → VP : α and : ∅ VP : β (intersection)

� Example:

S

NP VP

Bob VP and

sings

VP

dancesbob

λy.sings(y) λz.dances(z)

λx.sings(x) ∧ dances(x)

[λx.sings(x) ∧ dances(x)](bob)

sings(bob) ∧ dances(bob)