Course 5 – 22 March 2012 Diana Trandabă [email protected] 1.

48
Applications of Natural Language Processing Course 5 – 22 March 2012 Diana Trandabăț [email protected] 1

Transcript of Course 5 – 22 March 2012 Diana Trandabă [email protected] 1.

Page 1: Course 5 – 22 March 2012 Diana Trandabă dtrandabat@info.uaic.ro 1.

1

Applications of Natural Language

ProcessingCourse 5 – 22 March 2012

Diana Trandabăț[email protected]

Page 2: Course 5 – 22 March 2012 Diana Trandabă dtrandabat@info.uaic.ro 1.

2

Semantics in Language What are Semantic Roles? Semantic Role Resources Semantic Role Labeling Applications

Content

Page 3: Course 5 – 22 March 2012 Diana Trandabă dtrandabat@info.uaic.ro 1.

Semantics in Language

The three basic layers of grammatical organization are summarized as:◦Syntactic relations: perspectives through

which situations are presented in linguistic expressions;

◦Semantic relations: the roles that participants play;

◦Pragmatic relations: the informational status of linguistic expressions.

Page 4: Course 5 – 22 March 2012 Diana Trandabă dtrandabat@info.uaic.ro 1.

Semantics in Language

A key concern in NLP is how meaning attaches to larger chunks of text.

This is Natural Language Semantics:◦ WSD◦ Anaphora◦ Argument structure/semantic role◦ Discourse analysis◦ etc.

Page 5: Course 5 – 22 March 2012 Diana Trandabă dtrandabat@info.uaic.ro 1.

5

Nonsenses◦ Colorless green ideas sleep furiously◦ Kim frightened sincerity

Contradictions◦ It is raining and it is not raining◦ Kim killed Mary but she walked away.

Implications◦ John walked > John walked slowly◦ John sold the book to Mary > Mary bought the

book.

Semantic intuitions

Page 6: Course 5 – 22 March 2012 Diana Trandabă dtrandabat@info.uaic.ro 1.

What are Semantic Roles?

Linguistic background◦ Predicationality◦ Valence◦ Case Grammar

Description of Semantic Roles◦ Types of semantic roles◦ Characteristics of semantic roles

Semantic Role Resources◦ FrameNet, PropBank, VerbNet – for English◦ Resources for other languages

Page 7: Course 5 – 22 March 2012 Diana Trandabă dtrandabat@info.uaic.ro 1.

Linguistic background

Predicates (predicational words) designate events, properties of, or relations between, entities.

Linguistic expressions can be dependent or independent.◦ hat - can be understood outside any circumstance,

time, or person, it is an individual. ◦ red - cannot be understood outside its association

with an individual: red hat. In linguistic terms, dependent phenomena are

predicates, while individuals are arguments.

Page 8: Course 5 – 22 March 2012 Diana Trandabă dtrandabat@info.uaic.ro 1.

Semantic Roles

Predications are treated as structures, named predicate-frames (Dik, 1987) or semantic frames (Chomsky, 1965).

Within predicate frames, each entity plays a role, called:◦ theta-role Chomsky (1965). ◦ thematic relation (Gruber, 1965; Jackendoff, 1990)◦ semantic case (Fillmore, 1968)◦ semantic role (Dillon, 1977)◦ thematic role (Frawley, 1992)

Semantic roles are semantic relations that connect entities to events, more particularly, individuals to predicates.

Page 9: Course 5 – 22 March 2012 Diana Trandabă dtrandabat@info.uaic.ro 1.

9

Semantic Roles

Page 10: Course 5 – 22 March 2012 Diana Trandabă dtrandabat@info.uaic.ro 1.

Semantic Roles

Who, what, where, when, why? ◦ Predicates

Verbs: sell, buy, cost, etc. Nouns: acquisition, etc.

Actors buyer seller goods money time etc..

Page 11: Course 5 – 22 March 2012 Diana Trandabă dtrandabat@info.uaic.ro 1.

Semantic Roles

Who, what, where, when, why? ◦ Predicates

Verbs: sell, buy, cost, etc. Nouns: acquisition, etc.

◦ Actors buyer seller goods money time etc..

Page 12: Course 5 – 22 March 2012 Diana Trandabă dtrandabat@info.uaic.ro 1.

Semantic Roles

Who, what, where, when, why? ◦ Predicates

Verbs: sell, buy, cost, etc. Nouns: acquisition, etc.

◦ Actors buyer seller goods money time etc..

Semantic Frame

Page 13: Course 5 – 22 March 2012 Diana Trandabă dtrandabat@info.uaic.ro 1.

Semantic Roles

Who, what, where, when, why? ◦ Predicates

Verbs: sell, buy, cost, etc. Nouns: acquisition, etc.

◦ Actors buyer seller goods money time etc..

Semantic Frame

Semantic Roles

Page 14: Course 5 – 22 March 2012 Diana Trandabă dtrandabat@info.uaic.ro 1.

Ioana a cumpărat roşii de la Ion cu 2 lei.

cumpărător de la vânzător

bunuri cu bani

a cumpăra

Page 15: Course 5 – 22 March 2012 Diana Trandabă dtrandabat@info.uaic.ro 1.

Ioana a plătit 2 lei pentru roşii vânzătorului.

cumpărător vânzătorului

pentru bunuri bani

a plăti

Page 16: Course 5 – 22 March 2012 Diana Trandabă dtrandabat@info.uaic.ro 1.

Vânzătorul i-a cerut Ioanei 2 lei pentru roşii.

vânzător

pentru bunuri

cumpărător

bani

a cere

Page 17: Course 5 – 22 March 2012 Diana Trandabă dtrandabat@info.uaic.ro 1.

Valence

A predicational word needs, in order to complete its sense, arguments (mandatory) and adjuncts (optional).

Arguments:◦ Ion pleacă.◦ Ion citeşte o carte.

◦ Ion îi dă Mariei o carte. Adjuncts (circumstantial complements)

◦ Ion pleacă grăbit.

◦ Ion citeşte o carte în tren.

◦ Ion i-a dat Mariei o carte pentru trei zile.

Page 18: Course 5 – 22 March 2012 Diana Trandabă dtrandabat@info.uaic.ro 1.

Ioana a cumpărat roşii de la Ion cu 2 lei.

cumpărător de la vânzător

bunuri cu bani

a cumpăra

Page 19: Course 5 – 22 March 2012 Diana Trandabă dtrandabat@info.uaic.ro 1.

Ioana a plătit 2 lei pentru roşii vânzătorului.

cumpărător vânzătorului

pentru bunuri bani

a plăti

Page 20: Course 5 – 22 March 2012 Diana Trandabă dtrandabat@info.uaic.ro 1.

Vânzătorul i-a cerut Ioanei 2 lei pentru roşii.

vânzător

pentru bunuri

cumpărător

bani

a cere

Page 21: Course 5 – 22 March 2012 Diana Trandabă dtrandabat@info.uaic.ro 1.

Vânzătorul i-a cerut Ioanei 2 lei pentru roşii.

vânzător

pentru bunuri

cumpărător

bani

a cere

Page 22: Course 5 – 22 March 2012 Diana Trandabă dtrandabat@info.uaic.ro 1.

Cumpărarea roşiilor de către Ioana de la Ion cu 2 lei a fost o afacere bună.

cumpărător de la vânzător

bunuri cu bani

cumpărare

Page 23: Course 5 – 22 March 2012 Diana Trandabă dtrandabat@info.uaic.ro 1.

Cumpărarea roşiilor de către Ioana de la Ion cu 2 lei a fost o afacere bună.

cumpărător de la vânzător

bunuri cu bani

cumpărare

Page 24: Course 5 – 22 March 2012 Diana Trandabă dtrandabat@info.uaic.ro 1.

Case Grammar

Linguistic knowledge (Chomsky, 1968):◦ Surface Structure (syntax)◦ Deep structure (semantics)

Columb a descoperit America. America a fost descoperită de Columb.

◦ The linguistic process begins at the Deep Structure level with a non-verbal representation (an idea or a though) and ends in the Surface Structure, as we express ourselves.

Case Roles: representations of the lexical arguments of a predicate at semantic level.

Page 25: Course 5 – 22 March 2012 Diana Trandabă dtrandabat@info.uaic.ro 1.

Semantic Roles

Agent – Columb a descoperit America. Patient/Theme – Columb a descoperit

America. Experiencer – Rechinii au mirosit sânge. Beneficiary – I-a trimis mamei de săptămâna

trecută scrisoarea. Instrument – Au plecat cu vaporul. Location – În Hawaii e mult soare. Temporal – Ieri a nins. Commitatif – Copiii se joacă cu Maria. …

Page 26: Course 5 – 22 March 2012 Diana Trandabă dtrandabat@info.uaic.ro 1.

Classifications of Semantic Roles

Specificity: ◦ Abstract roles: Agent, Patient, etc.◦ Specific roles: specific to a certain verb or class of

verbs, as for instance Seller or Buyer for the verb sell.

Importance:◦ Core roles or Arguments◦ Peripheral roles or Adjuncts

Page 27: Course 5 – 22 March 2012 Diana Trandabă dtrandabat@info.uaic.ro 1.

(Assumed) Characteristics of Semantic Roles

There is a relatively small fixed set of semantic roles. Semantic roles are atomic (one role does not

subsume another). Every argument of every verb is assigned a

semantic role or another. Each argument of a verb is assigned exactly one

semantic role. Semantic roles are uniquely assigned within a verb

(e.g., only one argument can be dubbed agent). Semantic roles are non-relational: the presence of a

patient role does not imply the presence of an agent role.

Page 28: Course 5 – 22 March 2012 Diana Trandabă dtrandabat@info.uaic.ro 1.

Problems

A small fixed set of thematic roles has never been agreed on. Proposals range from just a few to hundreds.

Distinctness is hard to establish:◦ John met with Mary.◦ A is similar to B.

How and where to establish the boundary between role types (Instrument or Commitatif?)◦ John burgled the house [with an accomplice].◦ John won the appeal [with a highly-paid lawyer].

Page 29: Course 5 – 22 March 2012 Diana Trandabă dtrandabat@info.uaic.ro 1.

Semantic Role Resources

FrameNet - University Berkeley California◦ Create frame;◦ Identify semantic roles (frame elements) and

predicates (lexical units);◦ Search for examples containing the predicates in

the British National Corpus;◦ Annotate them on different levels: Semantic roles

(Frame Elements - FE), Grammatical Function (GF) and Phrase Type (PT).

11,600 lexical units in more than 960 semantic frames, exemplified in more than 150,000 annotated sentences.

Page 30: Course 5 – 22 March 2012 Diana Trandabă dtrandabat@info.uaic.ro 1.

Semantic Role Resources

PropBank – University Penn◦ focuses on the argument structure of verbs (NomBank

for nouns)◦ provides a complete corpus annotated with semantic

roles, including arguments and adjuncts.◦ PropBank defines semantic roles on a verb by verb

basis (defines a semantic frame for each verb, groups examples in frame sets for each verb).

◦ Semantic arguments of verbs are numbered from 0 to 4. (Arg0 - Agent, Arg1 - Patient or Theme)

◦ Verbs can have also general roles (adjuncts) marked as ARG-Ms (modifiers): TMP, LOC, MNR, REC, MOD, NEG, etc.

Page 31: Course 5 – 22 March 2012 Diana Trandabă dtrandabat@info.uaic.ro 1.

Semantic Role Resources

FrameNet:◦ [Chunk]Buyer bought [a car]Goods [from Jerry]Seller [for

$100]Money.

◦ [Jerry]Seller sold [a car]Goods [to Chuck]Buyer [for $100]Money.

PropBank◦ [Chunk]Arg0 bought [a car]Arg1 [from Jerry]Arg2 [for

$100]Arg3.

◦ [Jerry]Arg0 sold [a car]Arg1 [to Chuck]Arg2 [for $100]Arg3.

Page 32: Course 5 – 22 March 2012 Diana Trandabă dtrandabat@info.uaic.ro 1.

Semantic Role Resources for languages other than English

Two methods for creating new resources from English:◦ Merge: independent resources for different

languages are first built from scratch, than linked.◦ Expand: produce structurally similar resources

German FrameNet Japanese FrameNet Spanish FrameNet Romanian FrameNet

Merge approach

Expand approach

Page 33: Course 5 – 22 March 2012 Diana Trandabă dtrandabat@info.uaic.ro 1.

Creating a Semantic Role Resource for Romanian

Creating from scratch a semantic role resource implies several steps before the annotation process itself: ◦ finding a corpus,◦ establishing an annotation schema and defining

annotation guidelines, ◦ choosing/creating an annotation software, ◦ training annotators.

Page 34: Course 5 – 22 March 2012 Diana Trandabă dtrandabat@info.uaic.ro 1.

Intuition

The intuition behind the import program, presented in (Trandabat et al., 2005), is that most of the frames defined in the English FN are likely to be valid cross-linguistically, because semantic frames express conceptual structures, language independent, at the deep structure level.◦ load sentences from an annotated English frame;◦ translate them;◦ align the English and Romanian versions;◦ import the roles;◦ visualize, correct and save the annotations.

Page 35: Course 5 – 22 March 2012 Diana Trandabă dtrandabat@info.uaic.ro 1.

Semantic Role Transfer Architecture

Page 36: Course 5 – 22 March 2012 Diana Trandabă dtrandabat@info.uaic.ro 1.

Alignment

For the development phase of the import program, the English sentences have been aligned at word level using RACAI's aligner COWAL.

Although COWAL has an alignment precision of more than 87%, since the RACAI Aligner does not have yet a web service interface, and due to the fact that the import program is supposed to work also unassisted, the alignment have been implemented to work only with GIZA++.

Page 37: Course 5 – 22 March 2012 Diana Trandabă dtrandabat@info.uaic.ro 1.

Semantic Role Import

◦ reading the English XML files and the alignment files;◦ linking each English word with its corresponding

semantic role (FE);◦ mapping the English words with the aligned Romanian

translation, thus transferring the annotation of a specific role from English to Romanian. The mapping was performed by considering the import as a sequential labeling problem, with a B-I-O encoding.

The_B_Event incident_I_Event occurred_B_TARGET after_B_Time/Cause a_I_Time/Cause dispute_I_Time/Cause between_I_Time/Cause the_I_Time/ Cause man_I_Time/Cause and_I-Time/Cause staff_I_Time/Cause at_B_Place a_I_Place branch_I_Place of_I_Place the_I_Place Bank_I_Place of_I_Place Ireland_I_Place in_I_Place Cahir_I_Place ._O_NO-Frame

Page 38: Course 5 – 22 March 2012 Diana Trandabă dtrandabat@info.uaic.ro 1.

Semantic Role Import

One-to-zero import: the English word has no Romanian correspondent -> no action is needed.

One-to-one import: the English word has only one Romanian word as translation -> transfer.

One-to-many import: one English word being translated with two or more Romanian words. Based on empiric observations and the semantic roles nature, we decided to apply the following rule:

Page 39: Course 5 – 22 March 2012 Diana Trandabă dtrandabat@info.uaic.ro 1.

Semantic Role Import

Many-to-one import: two or more English words align with the same Romanian word (e.g. the definite article).

Zero-to-one import: This case requires

introducing a frame annotation to the Romanian word, without having a frame annotation in English. A Romanian has an I_Fi annotation when the word interrupts a frame (it breaks a consecutive sequence of B_Fi and I_Fi). Otherwise, the Romanian word will have the frame O NO-Frame.

Page 40: Course 5 – 22 March 2012 Diana Trandabă dtrandabat@info.uaic.ro 1.

Import evaluation

overall accuracy of approx. 85% Most frequent error types:

◦ Double Annotation The most frequent case of double annotation is for

the Time/Cause roles,◦ Imbrications◦ Unexpressed Semantic Frames

Page 41: Course 5 – 22 March 2012 Diana Trandabă dtrandabat@info.uaic.ro 1.

Applications of Semantic Role Labeling Systems

Semantic Roles in Question Answering◦ Annotate both questions and snippets for answer

extraction with semantic roles;◦ Create patterns of type:

ARG0 forced the adoption of the decision.◦ Really useful for purpose and temporal/local

questions

Page 42: Course 5 – 22 March 2012 Diana Trandabă dtrandabat@info.uaic.ro 1.

Applications of Semantic Role Labeling Systems

Semantic Roles for Prosody Generation◦ Apply Topic-Focus Articulation algorithm over the

text;◦ Create topic intonational structure;◦ Use semantic roles for determining which

constituents of a sentence are more accentuated: Predicate < Arguments < Adjuncts

Page 43: Course 5 – 22 March 2012 Diana Trandabă dtrandabat@info.uaic.ro 1.

43

1) Write an automatic role import program, that transfers the roles in language A into language B

2) Can it be used also for other import types? Which one? Explain why.

Requirements (Team: max 1 person, Deadline: 29 March)

Page 44: Course 5 – 22 March 2012 Diana Trandabă dtrandabat@info.uaic.ro 1.

44

Henriëtte de Swart, 1998, Introduction to Natural Language Semantics, CSLI Publications, Stanford.

Gildea Daniel and Jurafsky Daniel, Automatic labeling of semantic roles, Computational Linguistics, 28(3):245-288, 2002

Lluís Màrquez, Xavier Carreras, Kenneth C. Litkowski, Suzanne Stevenson, Semantic Role Labeling: An Introduction to the Special Issue, Computational Linguistics, Vol. 34, No. 2, Pages 145-159, 2008.

Trandabăț D., Natural Language Processing Using Semantic Frames, PhD Thesis, University Al. I. Cuza Iasi, Romania.

Bibliography

Page 45: Course 5 – 22 March 2012 Diana Trandabă dtrandabat@info.uaic.ro 1.

45

FrameNet https://framenet.icsi.berkeley.edu/fndrupal/

Propbank http://verbs.colorado.edu/~mpalmer/projects/ace.html

Semantic Role Labeling demo: http://cogcomp.cs.illinois.edu/demo/srl/

Links

Page 46: Course 5 – 22 March 2012 Diana Trandabă dtrandabat@info.uaic.ro 1.

46

Thanks!

Page 47: Course 5 – 22 March 2012 Diana Trandabă dtrandabat@info.uaic.ro 1.

Commerce_buy

Definition: These are words describing a basic commercial transaction involving a buyer and a seller exchanging money and goods, taking the perspecitive of the buyer. The words vary individually in the patterns of frame element realization they allow. For example, the typical pattern for the verb BUY: BUYER buys GOODS from SELLER for MONEY. Abby bought a car from Robin for $5,000. FEs: Core: Buyer [Byr] The Buyer wants the Goods and offers Money to a Seller in exchange for them. Jess BOUGHT a coat. Lee BOUGHT a textbook from Abby. Goods [Gds] The FE Goods is anything (including labor or time, for example) which is exchanged for Money

in a transaction. Only one winner PURCHASED the paintings Non-Core: Duration [Dur] Semantic Type Duration

The length of time that the Goods are (or have been) in the Buyer's possession. (This FE is generally only relevant for the LU's rent.v and lease.v which imply a temporary change of possession.)

Our neighbors have been RENTING their house for the last ten years. Manner [] Semantic Type Manner

Any description of the purchasing event which is not covered by more specific FEs, including secondary effects (quietly, loudly), and general descriptions comparing events (the same way). It may also indicate salient characteristics of the Buyerthat affect the action (presumptuously, coldly, deliberately, eagerly, carefully).

She gleefully BOUGHT the rock. Means [Mns] The means by which a commercial transaction occurs. Will they allow you to PURCHASE by check? Money [Mny] Money is the thing given in exchange for Goods in a transaction. Sam BOUGHT the car for $12,000. Place [Place] Where the event takes place. Purpose [Purp] The purpose for which an intentional act is performed. Purpose_of_goods [POG] The Buyer's intended purpose for the Goods. I PURCHASED the calculatorfor easier calculation of my debts. Rate [Rate] In some cases, price or payment is described per unit of Goods. Jon RENTED a car for twenty dollars a day Rate. Reason [Reas] The Reason for which an event occurs. Recipient [] The individual intended by the Buyer to receive the Goods. You BOUGHT me three pairs already! Seller [Slr] The Seller has possession of the Goods and exchanges them for Money from a Buyer.

Most of my audio equipment, I PURCHASED from a department store near my apartment.

Time [Time] When the event occurs. Unit [Unit] This FE is any unit in which goods or services can be measured. Generally, it occurs in a by-

PP. Lee BUYS potatoes by the pound. Lexical Units buy.v, purchase.v, purchase_((act)).n

Page 48: Course 5 – 22 March 2012 Diana Trandabă dtrandabat@info.uaic.ro 1.

PropBank -example

predicate lemma="sell">◦ Roleset sell.01◦ Arg0: Seller ◦ Arg1: Thing Sold◦ Arg2: Buyer◦ Arg3: Price Paid◦ Arg4: Benificiary

[It]Arg0 will sell [the ad time] Arg1 [to its clients] Arg2 [at a discount] Arg3

back