101035 中文信息处理 chinese nlp lecture 11. 句 —— 语义分析( 2 ) semantic analysis...

25
101035 中中中中中中 Chinese NLP Lecture 11

Upload: jessie-dalton

Post on 29-Dec-2015

349 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: 101035 中文信息处理 Chinese NLP Lecture 11. 句 —— 语义分析( 2 ) Semantic Analysis (2) 谓词逻辑的扩展( Expansions to predicate logic) 带语义的上下文无关语法(

101035 中文信息处理

Chinese NLP

Lecture 11

Page 2: 101035 中文信息处理 Chinese NLP Lecture 11. 句 —— 语义分析( 2 ) Semantic Analysis (2) 谓词逻辑的扩展( Expansions to predicate logic) 带语义的上下文无关语法(

2

句——语义分析( 2 )Semantic Analysis (2)

• 谓词逻辑的扩展( Expansions to predicate logic)

• 带语义的上下文无关语法( Semantic augmentation)

• 语义角色标注( Semantic role labeling )• 选择限制( Selectional restriction )

Page 3: 101035 中文信息处理 Chinese NLP Lecture 11. 句 —— 语义分析( 2 ) Semantic Analysis (2) 谓词逻辑的扩展( Expansions to predicate logic) 带语义的上下文无关语法(

3

谓词逻辑的扩展Expansions to Predicate

Logic

• Lambda Calculus ( λ 演算)• Lambda (λ) calculus is a logical tool that helps to

expand the descriptive power of predicate logic.

• λ-expressions are formed using the λ-operator. We can prefix the λ-operator, followed by a variable, to any first order formula or λ-expression. This practice is called λ-abstraction.

• For λx, substituting every occurrence of x with a specific proposition element is called λ-reduction.

Page 4: 101035 中文信息处理 Chinese NLP Lecture 11. 句 —— 语义分析( 2 ) Semantic Analysis (2) 谓词逻辑的扩展( Expansions to predicate logic) 带语义的上下文无关语法(

4

• Lambda Calculus

• Examples

• A proposition

• λ-abstractions

• λ-reductions

Restaurant(KFC)

Abstracting over the argument: λx Restaurant(x)

Abstracting over the predicate: λP P(KFC)

λx Restaurant(x) KFC = Restaurant(KFC) λP P(KFC) Restaurant = Restaurant(KFC)

Page 5: 101035 中文信息处理 Chinese NLP Lecture 11. 句 —— 语义分析( 2 ) Semantic Analysis (2) 谓词逻辑的扩展( Expansions to predicate logic) 带语义的上下文无关语法(

5

• Event Representation (事件的表达)• In an event, a predicate can take different numbers

of arguments.I ate. Eating1(Speaker)I ate a Turkey Sandwich. Eating2(Speaker,TurkeySandwich)I ate a Turkey Sandwich at my desk. Eating3(Speaker,TurkeySandwich,Desk)I ate at my desk. Eating4(Speaker,Desk)I ate lunch. Eating5(Speaker,Lunch)I ate a Turkey Sandwich for lunch. Eating6(Speaker,TurkeySandwich,Lunch)I ate a Turkey Sandwich for lunch at my desk. Eating7(Speaker,TurkeySandwich,Lunch,Desk)

Page 6: 101035 中文信息处理 Chinese NLP Lecture 11. 句 —— 语义分析( 2 ) Semantic Analysis (2) 谓词逻辑的扩展( Expansions to predicate logic) 带语义的上下文无关语法(

6

• Event Representation (事件的表达)• A better way is to use reification (具体化) to

elevate events to objects that can be quantified and related to other objects.

I ate. e ISA(e, Eating) Eater(e, Speaker)

I ate a Turkey Sandwich. e ISA(e, Eating) Eater(e, Speaker) Eaten(e, Sandwich)

I ate a Turkey Sandwich for lunch. e ISA(e, Eating) Eater(e, Speaker) Eaten(e, Sandwich) MealEaten(e, Lunch)

Page 7: 101035 中文信息处理 Chinese NLP Lecture 11. 句 —— 语义分析( 2 ) Semantic Analysis (2) 谓词逻辑的扩展( Expansions to predicate logic) 带语义的上下文无关语法(

7

In-Class Exercise

• Use reification to represent the event in the following.

Claire spent a week in Beijing. (Event: Spent, Spender: Claire SpentTime: Aweek, SpentPlace: Beijing)

Page 8: 101035 中文信息处理 Chinese NLP Lecture 11. 句 —— 语义分析( 2 ) Semantic Analysis (2) 谓词逻辑的扩展( Expansions to predicate logic) 带语义的上下文无关语法(

8

带语义的上下文无关语法Semantic Augmentation to

CFG

• From Syntax to Semantics

Page 9: 101035 中文信息处理 Chinese NLP Lecture 11. 句 —— 语义分析( 2 ) Semantic Analysis (2) 谓词逻辑的扩展( Expansions to predicate logic) 带语义的上下文无关语法(

9

• Semantic Attachments

• CFG rules can be augmented with semantic attachments.

• In computing the sentence meaning, CFG rules are used to combine constituents into larger constituents.

• λ calculus is used to guide the creation of logical forms in a principled fashion.

Page 10: 101035 中文信息处理 Chinese NLP Lecture 11. 句 —— 语义分析( 2 ) Semantic Analysis (2) 谓词逻辑的扩展( Expansions to predicate logic) 带语义的上下文无关语法(

10

• Example

• Semantically augmented CFG rules

(1) S NP VP {NP.sem(VP.sem)}

(2) NP Det Nominal {Det.Sem(Nominal.Sem)}

(3) Det every {λ P.λQ.∀xP(x) ⇒ Q(x)}

(4) Nominal Noun {Noun.sem}

(5) Noun restaurant {λ x Restaurant(x)}

(6) VP Verb {Verb.sem}

(7) Verb closed {λ x.∃e Closed(e)∧Closed(e, x)}

Every restaurant closed.

We use ⇒ for implication here because is used in the CFG rules.

Page 11: 101035 中文信息处理 Chinese NLP Lecture 11. 句 —— 语义分析( 2 ) Semantic Analysis (2) 谓词逻辑的扩展( Expansions to predicate logic) 带语义的上下文无关语法(

11

• Example

• Rule application

• Expansion of Det.Sem(Nominal.Sem)}, using (2)(3)(4)(5)

(8) λ P.λQ.∀xP(x) ⇒ Q(x)(λ x Restaurant(x))

• λ-reduction, using (8)

(9) λQ.∀x λ x Restaurant(x)(x) ⇒ Q(x)

• λ-reduction, using (9)

(10) λQ.∀x Restaurant(x) ⇒ Q(x)

• Expansion of NP.sem(VP.sem), using (1)(6)(7)(9)

(11) λQ.∀x Restaurant(x) ⇒ Q(x)(λy.∃e Closed(e)∧Closed(e, y))

• λ-reduction, using (11)

(12) ∀x Restaurant(x) ⇒ λy.∃e Closed(e)∧Closed(e, y)(x)

• λ-reduction, using (12)

(13) ∀x Restaurant(x) ⇒ ∃e Closed(e)∧Closed(e, x)

Every restaurant closed.

Page 12: 101035 中文信息处理 Chinese NLP Lecture 11. 句 —— 语义分析( 2 ) Semantic Analysis (2) 谓词逻辑的扩展( Expansions to predicate logic) 带语义的上下文无关语法(

12

语义角色标注Semantic Role Labeling

• Semantic Roles

• In an event, different event participants (arguments) play different roles.

Henry broke the window with a stone.

• In different events, a role may be played by different participants.

Henry broke the window.

Sarah opened the door.

• Semantic roles are useful in many NLP applications that require deep semantic understanding.

Page 13: 101035 中文信息处理 Chinese NLP Lecture 11. 句 —— 语义分析( 2 ) Semantic Analysis (2) 谓词逻辑的扩展( Expansions to predicate logic) 带语义的上下文无关语法(

13

• Common Semantic Roles

Semantic Role Definition

AGENT (施事) The volitional causer of an event

EXPERIENCER (经历者)

The experiencer of an event

FORCE (作用力) The non-volitional causer of the event

THEME (受事) The participant most directly affected by an event

RESULT (结果) The end product of an event

CONTENT (内容) The proposition or content of a propositional event

INSTRUMENT (工具)

An instrument used in an event

BENEFICIARY (受惠者)

The beneficiary of an event

SOURCE (来源) The origin of the object of a transfer event

GOAL (目标) The destination of an object of a transfer event

Page 14: 101035 中文信息处理 Chinese NLP Lecture 11. 句 —— 语义分析( 2 ) Semantic Analysis (2) 谓词逻辑的扩展( Expansions to predicate logic) 带语义的上下文无关语法(

14

• Common Semantic RolesSemantic Role Example

AGENT The waiter spilled the soup.

EXPERIENCER John has a headache.

FORCE The wind blows debris from the mall into our yards.

THEME Only after Benjamin Franklin broke the ice...

RESULT The French government has built a regulation-size baseball diamond...

CONTENT Mona asked “You met Mary Ann at a supermarket”?

INSTRUMENTHe turned to poaching catfish, stunning them with a shocking device...

BENEFICIARY Whenever Ann Callahan makes hotel reservations for her boss...

SOURCE I flew in from Boston.

GOAL I drove to Portland.

Page 15: 101035 中文信息处理 Chinese NLP Lecture 11. 句 —— 语义分析( 2 ) Semantic Analysis (2) 谓词逻辑的扩展( Expansions to predicate logic) 带语义的上下文无关语法(

15

• Semantic Role Labeling (SRL)The San Francisco Examiner issued a special edition

around noon yesterday.

AGENT THEME TIME

ARG0 ARG1 ARGM-TMP

• Semantic role labeling is the task of automatically finding the semantic roles for each predicate in a sentence.

Standard semantic roles

Generalized semantic roles, according to

PropBank

TAGRET

Page 16: 101035 中文信息处理 Chinese NLP Lecture 11. 句 —— 语义分析( 2 ) Semantic Analysis (2) 谓词逻辑的扩展( Expansions to predicate logic) 带语义的上下文无关语法(

16

• Semantic Role Labeling

• SRL is often treated as a supervised machine learning task.

• A lot of training examples are needed, each in the form of [feature vector]: label.

• For supervised learning, Naïve Bayes or Decision Tree can be used.

• Much of SRL is working out the feature vector, which is often based on syntactic parsing.

Page 17: 101035 中文信息处理 Chinese NLP Lecture 11. 句 —— 语义分析( 2 ) Semantic Analysis (2) 谓词逻辑的扩展( Expansions to predicate logic) 带语义的上下文无关语法(

17

• Example

• Parse tree

The San Francisco Examiner issued a special edition around noon yesterday.

Page 18: 101035 中文信息处理 Chinese NLP Lecture 11. 句 —— 语义分析( 2 ) Semantic Analysis (2) 谓词逻辑的扩展( Expansions to predicate logic) 带语义的上下文无关语法(

18

• Example

• Features (for NP-SBJ)

1. the governing predicate (issued)

2. the phrase type of the constituent (NP)

3. the head word of the constituent (Examiner)

4. the head word part-of-speech of the constituent (NNP)

5. the path in the parse tree from the constituent to the predicate

(NP↑S↓VP↓VBD)

6. the voice of the clause in which the constituent appears (active)

7. The binary linear position of the constituent with respect to the

predicate (before)

8. the sub-categorization (expected arguments) of the predicate

(VP→NP PP)

The San Francisco Examiner issued a special edition around noon yesterday.

ARG0: [issued, NP, Examiner, NNP, NP↑S↓VP↓VBD, active, before, VP→NP PP]

Page 19: 101035 中文信息处理 Chinese NLP Lecture 11. 句 —— 语义分析( 2 ) Semantic Analysis (2) 谓词逻辑的扩展( Expansions to predicate logic) 带语义的上下文无关语法(

19

In-Class Exercise

• Extract the features for NP (ARG1) in the example sentence, according to the scheme on the previous page.

The San Francisco Examiner issued a special edition around noon yesterday.

Page 20: 101035 中文信息处理 Chinese NLP Lecture 11. 句 —— 语义分析( 2 ) Semantic Analysis (2) 谓词逻辑的扩展( Expansions to predicate logic) 带语义的上下文无关语法(

20

选择限制Selectional Restriction

• Basics

• Selectional restriction is a kind of semantic type constraint that a verb imposes on the kind of concepts that are allowed to fill its argument roles.

• Selectional restrictions are associated with senses, not entire lexemes.

• Selectional restrictions vary widely in their specificity.

Page 21: 101035 中文信息处理 Chinese NLP Lecture 11. 句 —— 语义分析( 2 ) Semantic Analysis (2) 谓词逻辑的扩展( Expansions to predicate logic) 带语义的上下文无关语法(

21

• ExamplesI want to eat someplace that is near Jiashi.

THEME of eat? LOCATION of eat?

THEME of eat is edible.

The restaurant served green-lipped mussels.Which airlines serve Denver?

I often ask the musicians to imagine a tennis game.To diagonalize a matrix is to find its eigenvalues.

THEME of imagine can be almost anything.THEME of diagonalize must be matrix.

Page 22: 101035 中文信息处理 Chinese NLP Lecture 11. 句 —— 语义分析( 2 ) Semantic Analysis (2) 谓词逻辑的扩展( Expansions to predicate logic) 带语义的上下文无关语法(

22

• Selectional Restriction Representation

• Verb

• Representing semantic role

• Representing selectional restriction

eat

e, x, y Eating(e) Agent(e, x) Theme(e, y)

e, x, y Eating(e) Agent(e, x) Theme(e, y) ISA(y, EdibleThing)

Page 23: 101035 中文信息处理 Chinese NLP Lecture 11. 句 —— 语义分析( 2 ) Semantic Analysis (2) 谓词逻辑的扩展( Expansions to predicate logic) 带语义的上下文无关语法(

23

• Selectional Restriction in Terms of WordNet Synsets

• WordNet is a lexical database for the English language. It groups English words into sets of synonyms called synsets.

• Example: synset for the word “hamburger” and its hypernyms

Page 24: 101035 中文信息处理 Chinese NLP Lecture 11. 句 —— 语义分析( 2 ) Semantic Analysis (2) 谓词逻辑的扩展( Expansions to predicate logic) 带语义的上下文无关语法(

24

• Selectional Restriction in Terms of WordNet Synsets

• Exampleate a hamburger

Page 25: 101035 中文信息处理 Chinese NLP Lecture 11. 句 —— 语义分析( 2 ) Semantic Analysis (2) 谓词逻辑的扩展( Expansions to predicate logic) 带语义的上下文无关语法(

25

• 谓词逻辑的扩展• Lambda Calculus

• Event Representation

• 带语义的上下文无关语法• Semantic Attachments

• Lambda Operations

Wrap-Up

• 语义角色标注• Semantic Roles

• Semantic Role Examples

• Semantic Role Labeling

• 选择限制• Concept

• Using Logic Form

• Using WordNet Synsets