44
Language Processing and Computational Linguistics EDA171/DATN06 – Lecture 13 Lexical Semantics Richard Johansson [email protected] http://www.cs.lth.se/ ~richard © Pierre Nugues, Lecture 13, September 30, 2008 1

Words and Meaning - Lunds tekniska högskola · Web viewThe Naïve Bayes model is based on the bag-of-word approach: it assumes that words occur independently of each other. We replace

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Words and Meaning - Lunds tekniska högskola · Web viewThe Naïve Bayes model is based on the bag-of-word approach: it assumes that words occur independently of each other. We replace

Language Processing and Computational Linguistics

EDA171/DATN06 – Lecture 13Lexical Semantics

Richard [email protected]

http://www.cs.lth.se/~richard

© Pierre Nugues, Lecture 13, September 30, 2008 1

Page 2: Words and Meaning - Lunds tekniska högskola · Web viewThe Naïve Bayes model is based on the bag-of-word approach: it assumes that words occur independently of each other. We replace

Today’s Lecture

Lexical Semantics: how do we represent and process the meaning of words? The structure of dictionaries. Ontologies / semantic networks. Word senses. Sense ambiguity. Sense disambiguation. Putting pieces together: valence, selectional

restrictions, …

© Pierre Nugues, Lecture 13, September 30, 2008 2

Page 3: Words and Meaning - Lunds tekniska högskola · Web viewThe Naïve Bayes model is based on the bag-of-word approach: it assumes that words occur independently of each other. We replace

Words and Meaning

Referred to as lexical semantics: Classes of words: If it is hot, can it be cold? Definition What is a meal? What is table? Reasoning: The meal is on the table. Is it cold?

© Pierre Nugues, Lecture 13, September 30, 2008 3

Page 4: Words and Meaning - Lunds tekniska högskola · Web viewThe Naïve Bayes model is based on the bag-of-word approach: it assumes that words occur independently of each other. We replace

Categories of Words

Expressions, which are in no way composite, signify substance, quantity, quality, relation, place, time, position, state, action, or affection. To sketch my meaning roughly, examples of substance are ‘man’ or ‘the horse’, of quantity, such terms as ‘two cubits long’ or ‘three cubits long’, of quality, such attributes as ‘white’, ‘grammatical’. ‘Double’, ‘half’, ‘greater’, fall under the category of relation; ‘in the market place’, ‘in the Lyceum’, under that of place; ‘yesterday’, ‘last year’, under that of time. ‘Lying’, ‘sitting’, are terms indicating position, ‘shod’, ‘armed’, state; ‘to lance’, ‘to cauterize’, action; ‘to be lanced’, ‘to be cauterized’, affection.

Aristotle, Categories, IV. (trans. E. M. Edghill)© Pierre Nugues, Lecture 13, September 30, 2008 4

Page 5: Words and Meaning - Lunds tekniska högskola · Web viewThe Naïve Bayes model is based on the bag-of-word approach: it assumes that words occur independently of each other. We replace

Representation of Categories

substance quality state relation action position place time quantity affection

expressions

© Pierre Nugues, Lecture 13, September 30, 2008 5

Page 6: Words and Meaning - Lunds tekniska högskola · Web viewThe Naïve Bayes model is based on the bag-of-word approach: it assumes that words occur independently of each other. We replace

Definitions

Short texts describing a word: A genus or superclass using a hypernym. Specific attributes to differentiate it from other

members of the superclass. This part of the definition is called the differentia specifica.

bank (1.1): a land sloping up along each side of a canal or a river.hedgehog: a small animal with stiff spines covering its back.waiter: a person employed to serve customers at their table in a restaurant, etc .

© Pierre Nugues, Lecture 13, September 30, 2008 6

Page 7: Words and Meaning - Lunds tekniska högskola · Web viewThe Naïve Bayes model is based on the bag-of-word approach: it assumes that words occur independently of each other. We replace

Relations between Words in a Dictionary

Synonymy/Antonymy Hyponyms/Hypernyms is_a(tree, plant), life form, entity Meronyms/Holonyms part_of(leg, table) …

© Pierre Nugues, Lecture 13, September 30, 2008 7

Page 8: Words and Meaning - Lunds tekniska högskola · Web viewThe Naïve Bayes model is based on the bag-of-word approach: it assumes that words occur independently of each other. We replace

Semantic Networks – Ontologies

food

animates

human beings furnitureanimals

substance

possess

eat

carnivoresinsectivores

meatmammals

eat

© Pierre Nugues, Lecture 13, September 30, 2008 8

Page 9: Words and Meaning - Lunds tekniska högskola · Web viewThe Naïve Bayes model is based on the bag-of-word approach: it assumes that words occur independently of each other. We replace

An Example: WordNet

Based on the concept of the synset.Nouns Hyponyms/hypernyms

Synonyms/antonymsMeronyms/holonyms

Adjectives Synonyms/antonymsRelational fraternal --> brother

Verbs Semantic domains (body function, change, communication, perception, contact, motion, creation, possession, competition, emotion, cognition, social interaction, weather)Synonymy, Antonymy: (rise/fall, ascent/descent, be born/die)“Entailment”: succeed/try, snore/sleep

© Pierre Nugues, Lecture 13, September 30, 2008 9

Page 10: Words and Meaning - Lunds tekniska högskola · Web viewThe Naïve Bayes model is based on the bag-of-word approach: it assumes that words occur independently of each other. We replace

Lexical Database

%% is_a(?Word, ?Hypernym)is_a(hedgehog, insectivore).is_a(cat, feline).is_a(feline, carnivore).is_a(insectivore, mammal).is_a(carnivore, mammal).is_a(mammal, animal).is_a(animal, animate_being).

hypernym(X, Y) :- is_a(X, Y).hypernym(X, Y) :- is_a(X, Z), hypernym(Z, Y).

© Pierre Nugues, Lecture 13, September 30, 2008 10

Page 11: Words and Meaning - Lunds tekniska högskola · Web viewThe Naïve Bayes model is based on the bag-of-word approach: it assumes that words occur independently of each other. We replace

Semantics and Reasoning

The caterpillar ate the hedgehog.Representation:∃(X, Y), caterpillar(X) & hedgehog(Y) & ate(X, Y).

Reasoning (inference):It is untrue because the query:?- predator(X, hedgehog)X = foxes, eagles, car drivers, …but no caterpillar.

© Pierre Nugues, Lecture 13, September 30, 2008 11

Page 12: Words and Meaning - Lunds tekniska högskola · Web viewThe Naïve Bayes model is based on the bag-of-word approach: it assumes that words occur independently of each other. We replace

Word ambiguity: Homonymy and Polysemy

Words are ambiguous: A single form may have more than one entry (homonymy) and sense (polysemy).The Oxford Advanced Learner’s Dictionary (OALD) lists five entries for bank: Raised ground Organization Turn.and five senses for the first entry.The distinction between homonymy and polysemy is sometimes problematic. WordNet does not distinguish.Polysemy is productive! “bank of English”

© Pierre Nugues, Lecture 13, September 30, 2008 12

Page 13: Words and Meaning - Lunds tekniska högskola · Web viewThe Naïve Bayes model is based on the bag-of-word approach: it assumes that words occur independently of each other. We replace

Sense Distinctions Vary Across Languages

Granularity: Boundaries:Swedish English French Welshsätta2 gwyrdd

ställa1 put1 vert

lägga1 bleuglas

grisllwyd

brun

© Pierre Nugues, Lecture 13, September 30, 2008 13

Page 14: Words and Meaning - Lunds tekniska högskola · Web viewThe Naïve Bayes model is based on the bag-of-word approach: it assumes that words occur independently of each other. We replace

Sense Tagging Using the OALD

The patron ordered a mealWords Definitions Sensepatron Correct sense: A customer of a shop, restaurant, theater 1.2

Alternate sense: A person who gives money or support to a person, an organization, a cause or an activity

1.1

ordered Correct sense: To request somebody to bring food, drink, etc in a hotel, restaurant etc.

2.3

Alternate senses: To give an order to somebodyTo request somebody to supply or make goods, etc.To put something in order

2.12.22.4

Meal Correct sense: The food eaten on such occasionAlternate sense: An occasion where food is eaten

1.21.1

© Pierre Nugues, Lecture 13, September 30, 2008 14

Page 15: Words and Meaning - Lunds tekniska högskola · Web viewThe Naïve Bayes model is based on the bag-of-word approach: it assumes that words occur independently of each other. We replace

Identifying Senses Automatically

The problem of determining sense is called word sense disambiguation.This is one of the most difficult tasks in NLP – the best systems are only slightly better than the baseline.Two broad approaches: Statistical methods based on co-occurrence statistics Dictionary-based methods

Hybrids are common.Both approaches rely crucially on the context to disambiguate.

© Pierre Nugues, Lecture 13, September 30, 2008 15

Page 16: Words and Meaning - Lunds tekniska högskola · Web viewThe Naïve Bayes model is based on the bag-of-word approach: it assumes that words occur independently of each other. We replace

Bayesian Sense Disambiguation

We analyze the interaction between bank and market finance in a model where bankers gather information through monitoring…Statistical techniques optimize a sequence of semantic tags.The context

C is defined as

w−m ,w−m +1,...,w−1,w,w1,...,wm−1,wm .The optimal sense

ˆ s = argmaxsi ,1≤ i≤n

P(si | C).Using Bayes’ theorem, we have:

)|,,...,,,...,,()(maxarg

)|()(maxargˆ

11111,

1,

immmminis

iinis

swwwwwwPsP

sCPsPs

i

i

−−+−−≤≤

≤≤

=

=

© Pierre Nugues, Lecture 13, September 30, 2008 16

Page 17: Words and Meaning - Lunds tekniska högskola · Web viewThe Naïve Bayes model is based on the bag-of-word approach: it assumes that words occur independently of each other. We replace

Naïve Bayes

The Naïve Bayes model is based on the bag-of-word approach: it assumes that words occur independently of each other. We replace )|,,...,,,...,,( 1111 immmm swwwwwwP −−+−− with the product of probabilities:

∏≠−=≤≤

=m

jmjiji

nisswPsPs

i 0,1,)|()(maxargˆ

To train the model, we can use SemCor, which is a sense-annotated corpus for English.In addition to supervised methods like Naïve Bayes, semisupervised and unsupervised algorithms exist.

© Pierre Nugues, Lecture 13, September 30, 2008 17

Page 18: Words and Meaning - Lunds tekniska högskola · Web viewThe Naïve Bayes model is based on the bag-of-word approach: it assumes that words occur independently of each other. We replace

Using Dictionaries (Lesk and derived methods)

We analyze the interaction between bank and market finance in a model where bankers gather information through monitoring and screeningMaximally overlapping definitions:Bank: Bank1: The land sloping up along each side of a river or a canal; he

ground near a river Bank2: An organization or a place that provides a financial service.

Customers keep their money in the bank safely and it is paid out…Finance: Finance: The money used or needed to support an activity, project,

etc; the management of money

© Pierre Nugues, Lecture 13, September 30, 2008 18

Page 19: Words and Meaning - Lunds tekniska högskola · Web viewThe Naïve Bayes model is based on the bag-of-word approach: it assumes that words occur independently of each other. We replace

Valence Patterns

Dictionaries store information about how words combine with other words to form larger structures. This information is called valence (cf. valence in chemistry)

OALD, tell1:~ sb (sth) / ~ sth to sb

I told him a lie I told a lie to him

© Pierre Nugues, Lecture 13, September 30, 2008 19

Page 20: Words and Meaning - Lunds tekniska högskola · Web viewThe Naïve Bayes model is based on the bag-of-word approach: it assumes that words occur independently of each other. We replace

Syntactic Side: Verb Construction Models

English French Germandepend + on + object noun group

dépendre + de + object noun group

hängen + von + dative noun group + ab

I like + verb-ing (gerund)

Ça me plaît de + infinitive

es gefällt mir + zu + infinitive

require + verb-ing (gerund)

demander + de + infinitive

verlangen + accusative noun group

© Pierre Nugues, Lecture 13, September 30, 2008 20

Page 21: Words and Meaning - Lunds tekniska högskola · Web viewThe Naïve Bayes model is based on the bag-of-word approach: it assumes that words occur independently of each other. We replace

Semantic Side: Selectional Restrictions

Three kinds of wanting:1. Wanting something to happen,2. Wanting an object,3. Wanting a person.and (2.) will be mapped on:word(category: verb, agent: persons, object: objects) --> [want].Properties of word mean: adjective, qualify only persons, and express badness:word(category: adjective, applyTo: persons, expresses: badness)--> [mean].

© Pierre Nugues, Lecture 13, September 30, 2008 21

Page 22: Words and Meaning - Lunds tekniska högskola · Web viewThe Naïve Bayes model is based on the bag-of-word approach: it assumes that words occur independently of each other. We replace

Case Grammar

An idea from Indian grammarians (~500 BC): Define a set of semantic cases (or semantic roles):•An Agent – Instigator of the action (typically animate)•An Instrument – Cause of the event or object in causing the event

(typically animate)•An Object – Entity that is acted upon or that changes, the most

general case.•A Dative – Entity affected by the action (typically animate)•A Locative – Place of the event•…Used by linguists to study the relations between valence patternsUsed in NLP to build flexible template-filling applications

© Pierre Nugues, Lecture 13, September 30, 2008 22

Page 23: Words and Meaning - Lunds tekniska högskola · Web viewThe Naïve Bayes model is based on the bag-of-word approach: it assumes that words occur independently of each other. We replace

Case Grammar: An Example

open(O, {A}, {I})

The door opened O = doorJohn opened the door O = door and A = JohnThe wind opened the door O = door and I = windJohn opened the door with a chisel

O = door, A = John, and I = chisel

© Pierre Nugues, Lecture 13, September 30, 2008 23

Page 24: Words and Meaning - Lunds tekniska högskola · Web viewThe Naïve Bayes model is based on the bag-of-word approach: it assumes that words occur independently of each other. We replace

Parsing with Cases

The waiter brought the meal to the patronIdentify the verb bring and apply constraints:

Bring

Case Value

Agentive Animate (Obligatory) The waiter

Object (Obligatory) the mealDative Animate (Optional) the

patronTime (Obligatory) past

© Pierre Nugues, Lecture 13, September 30, 2008 24

Page 25: Words and Meaning - Lunds tekniska högskola · Web viewThe Naïve Bayes model is based on the bag-of-word approach: it assumes that words occur independently of each other. We replace

FrameNet

In 1968, Fillmore wrote an oft-cited paper on case grammars.Later, he started the FrameNet project.In FrameNet, Fillmore no longer uses universal cases but a set of frames – semantic templates – where each frame is specific to a class of words.Framenet is a medium-sized lexical database that maps English words to frames.Examples of frames: Revenge, Statement, Impact, …

© Pierre Nugues, Lecture 13, September 30, 2008 25

Page 26: Words and Meaning - Lunds tekniska högskola · Web viewThe Naïve Bayes model is based on the bag-of-word approach: it assumes that words occur independently of each other. We replace

The Revenge Frame

15 lexical units (dictionary entries):avenge.v, avenger.n, get back (at).v, get_even.v, retaliate.v, retaliation.n, retribution.n, retributive.a, retributory.a, revenge.n, revenge.v, revengeful.a, revenger.n, vengeance.n, vengeful.a, and vindictive.a.Examples of frame elements (template slots)Avenger, Punishment, Offender, Injury, and Injured_party.The word in a sentence that is tied to a frame is called the target.

© Pierre Nugues, Lecture 13, September 30, 2008 26

Page 27: Words and Meaning - Lunds tekniska högskola · Web viewThe Naïve Bayes model is based on the bag-of-word approach: it assumes that words occur independently of each other. We replace

Annotation

1. [<Avenger> His brothers] avenged [<Injured_party> him].2. [<Punishment>With this], [<Avenger> El Cid] at once avenged

[<Injury> the death of his son].3. [<Avenger> Hook] tries to avenge [<Injured_party> himself]

[<Offender> on Peter Pan] [<Punishment> by becoming a second and better father].

© Pierre Nugues, Lecture 13, September 30, 2008 27

Page 28: Words and Meaning - Lunds tekniska högskola · Web viewThe Naïve Bayes model is based on the bag-of-word approach: it assumes that words occur independently of each other. We replace

Automatic Frame-semantic Analysis

Given a syntax tree and a target word Find the arguments, Determine the template slot of each argument

to l dhim a lie I

SBJ IO B J

OBJRO O T

© Pierre Nugues, Lecture 13, September 30, 2008 28

Page 29: Words and Meaning - Lunds tekniska högskola · Web viewThe Naïve Bayes model is based on the bag-of-word approach: it assumes that words occur independently of each other. We replace

Classification of Semantic Arguments

The task of classifying semantic arguments can be modeled as a statistical classification problem.

What features are useful for this task? Examples: Grammatical function: subject, object, … Voice: “I told a lie” / “I was told a lie” Semantic classes: “I told him” / “the note told him” Semantic class usually not available: use word instead

© Pierre Nugues, Lecture 13, September 30, 2008 29

Page 30: Words and Meaning - Lunds tekniska högskola · Web viewThe Naïve Bayes model is based on the bag-of-word approach: it assumes that words occur independently of each other. We replace

Example

Given a dependency tree:

to l dhim a lie I

SBJ IO B J

OBJRO O T

We select the three dependents of told:I: GF = Subject voice = Active word = Ihim: GF = Indirect object voice = Active word = himlie: GF = Direct object voice = Active word = lie

© Pierre Nugues, Lecture 13, September 30, 2008 30

Page 31: Words and Meaning - Lunds tekniska högskola · Web viewThe Naïve Bayes model is based on the bag-of-word approach: it assumes that words occur independently of each other. We replace

When Semantics Is Too Difficult: “Semantic Grammar”

sentence --> npInsectivores, ingest, npCrawlingInsects.npInsectivores --> det, insectivores.npCrawlingInsects --> det, crawlingInsects.insectivores --> [mole].insectivores --> [hedgehog].ingest --> [devours].ingest --> [eats].crawlingInsects --> [worms].crawlingInsects --> [caterpillars].det --> [the].

© Pierre Nugues, Lecture 13, September 30, 2008 31

Page 32: Words and Meaning - Lunds tekniska högskola · Web viewThe Naïve Bayes model is based on the bag-of-word approach: it assumes that words occur independently of each other. We replace

An Application: EVAR

EVAR was a German project to provide information on trains.

noun

concrete abstract

thing location animate worth classifying time

transport human beast

© Pierre Nugues, Lecture 13, September 30, 2008 32

Page 33: Words and Meaning - Lunds tekniska högskola · Web viewThe Naïve Bayes model is based on the bag-of-word approach: it assumes that words occur independently of each other. We replace

EVAR’s Valence Dictionary

1. fahren1.1(”The train is going from Hamburg to Munich”) Instrument: noun group (nominative), Transport, obligatory Source: prepositional group (Origin), Location, optional Goal: prepositional group (Direction), Location, optional

2. fahren1.2(”I am going by train from Hamburg to Munich”) Agent: noun group (nominative), Animate, obligatory Instrument: prepositional group (prep = mit), Transport,

optional Source: prepositional group (Origin), Location, optional Goal: prepositional group (Direction), Location, optional

3. Abfahrt1.1(”the departure of the train at Hamburg for Munich”) Object: noun group (genitive), Transport, optional

© Pierre Nugues, Lecture 13, September 30, 2008 33

Page 34: Words and Meaning - Lunds tekniska högskola · Web viewThe Naïve Bayes model is based on the bag-of-word approach: it assumes that words occur independently of each other. We replace

Another Application: Traffic Accidents

[<Location>På landsvägen mellan Lund och Staffanstorp] krockade [<Time>i morse] [<Actor>en motorcyklist] [<Manner> våldsamt] [<Victim>med ett träd].

… efter en [<Manner>oförsiktig] omkörning …

© Pierre Nugues, Lecture 13, September 30, 2008 34