csci 5832 natural language processingmartin/csci5832/slides/lecture_18.pdflecture 18 3/20/08 2 today...

14
1 3/20/08 1 CSCI 5832 Natural Language Processing Jim Martin Lecture 18 3/20/08 2 Today 3/20 • Semantics 3/20/08 3 Transition First we did words (morphology) Then simple sequences of words Then we looked at true syntax Now we’re moving on to meaning. Where some would say we should have started to begin with.

Upload: others

Post on 08-Jul-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CSCI 5832 Natural Language Processingmartin/Csci5832/Slides/lecture_18.pdfLecture 18 3/20/08 2 Today 3/20 •Semantics 3/20/08 3 Transition ... Semantic Analysis •Compositional Analysis

1

3/20/08 1

CSCI 5832Natural Language Processing

Jim MartinLecture 18

3/20/082

Today 3/20

• Semantics

3/20/083

Transition

• First we did words (morphology)• Then simple sequences of words• Then we looked at true syntax• Now we’re moving on to meaning. Where

some would say we should have started tobegin with.

Page 2: CSCI 5832 Natural Language Processingmartin/Csci5832/Slides/lecture_18.pdfLecture 18 3/20/08 2 Today 3/20 •Semantics 3/20/08 3 Transition ... Semantic Analysis •Compositional Analysis

2

3/20/084

Example

Even if this is the right tree,what does that tell us about themeaning?

3/20/085

Meaning

• Language is useful and amazing because itallows us to encode/decode… Descriptions of the world What we’re thinking What we think about what other people think

• Don’t be fooled by how natural and easy it is…In particular, you never really… Utter word strings that match the world Say what you’re thinking Say what you think about what other people think

3/20/086

Meaning

• You’re simply uttering linear sequences ofwords such that when other peopleread/hear and understand them they cometo know what you think of the world.

Page 3: CSCI 5832 Natural Language Processingmartin/Csci5832/Slides/lecture_18.pdfLecture 18 3/20/08 2 Today 3/20 •Semantics 3/20/08 3 Transition ... Semantic Analysis •Compositional Analysis

3

3/20/087

Meaning Representations

• We’re going to take the same basic approach tomeaning that we took to syntax and morphology

• We’re going to create representations of linguisticinputs that capture the meanings of those inputs.

• But unlike parse trees and the like theserepresentations aren’t primarily descriptions of thestructure of the inputs…

3/20/088

Meaning Representations

• In most cases, they’re simultaneouslydescriptions of the meanings of utterancesand of some potential state of affairs insome world.

3/20/089

Meaning Representations

• What could this mean… representations of linguistic inputs that

capture the meanings of those inputs• For us it means

Representations that permit or facilitatesemantic processing

Page 4: CSCI 5832 Natural Language Processingmartin/Csci5832/Slides/lecture_18.pdfLecture 18 3/20/08 2 Today 3/20 •Semantics 3/20/08 3 Transition ... Semantic Analysis •Compositional Analysis

4

3/20/0810

Semantic Processing

• Ok, so what does that mean?• Representations that

Permit us to reason about their truth(relationship to some world)

Permit us to answer questions based on theircontent

Permit us to perform inference (answerquestions and determine the truth of things wedon’t actually know)

3/20/0811

Semantic Processing

• Touchstone application is often questionanswering Can a machine answer questions involving

the meaning of some text or discourse? What kind of representations do we need to

mechanize that process?

3/20/0812

Semantic Processing

• We’re going to discuss 2 ways to attack thisproblem (just as we did with parsing) There’s the principled, theoretically motivated

approach… Computational/Compositional Semantics

• Chapters 17 and 18

And there are limited, practical approaches that havesome hope of being useful Information extraction

• Chapter 22

Page 5: CSCI 5832 Natural Language Processingmartin/Csci5832/Slides/lecture_18.pdfLecture 18 3/20/08 2 Today 3/20 •Semantics 3/20/08 3 Transition ... Semantic Analysis •Compositional Analysis

5

3/20/0813

Semantic Analysis

• Compositional Analysis Create a FOL representation that accounts for

all the entities, roles and relations present in asentence. Similar to our approach to full parsing

• Information Extraction Do a superficial analysis that pulls out only the

entities, relations and roles that are of interestto the consuming application. Similar to chunking

3/20/0814

Information Extraction (preview)

Investigators worked leads Monday inRiverside County where the car wasreported stolen and reviewedsecurity tape from Highway 241 whereit was abandoned, said city ofAnaheim spokesman John Nicoletti.

3/20/0815

Information ExtractionNamed Entities

• Investigators worked leads Monday in Riverside Countywhere the car was reported stolen and reviewed securitytape from Highway 241 where it was abandoned, said cityof Anaheim spokesman John Nicoletti.

Investigators worked leads [Monday] in[Riverside County] where the car wasreported stolen and reviewed securitytape from [Highway 241] where it wasabandoned, said city of [Anaheim]spokesman [John Nicoletti].

Page 6: CSCI 5832 Natural Language Processingmartin/Csci5832/Slides/lecture_18.pdfLecture 18 3/20/08 2 Today 3/20 •Semantics 3/20/08 3 Transition ... Semantic Analysis •Compositional Analysis

6

3/20/0816

Information ExtractionEvents

• Investigators worked leads Monday in Riverside Countywhere the car was reported stolen and reviewed securitytape from Highway 241 where it was abandoned, said cityof Anaheim spokesman John Nicoletti.

Investigators worked leads Monday inRiverside County where the car wasreported stolen and reviewed securitytape from Highway 241 where it wasabandoned, said city of Anaheimspokesman John Nicoletti.

3/20/0817

Information ExtractionEvents

• Investigators worked leads Monday in Riverside Countywhere the car was reported stolen and reviewed securitytape from Highway 241 where it was abandoned, said cityof Anaheim spokesman John Nicoletti.

Investigators worked leads Monday inRiverside County where the car wasreported stolen and reviewed securitytape from Highway 241 where it wasabandoned, said city of Anaheimspokesman John Nicoletti.

3/20/0818

Break

• Today’s material is a mixture of Chapters17 and 18.

• The next quiz will be pushed back to 4/15and will cover 17,18,19,20

Page 7: CSCI 5832 Natural Language Processingmartin/Csci5832/Slides/lecture_18.pdfLecture 18 3/20/08 2 Today 3/20 •Semantics 3/20/08 3 Transition ... Semantic Analysis •Compositional Analysis

7

3/20/0819

Break

• I’m not normally this scatterbrained.• We’re going to finish delivery of the book

by next week (assuming we can makeacrobat do the right things).

• I’ll be less disorganized when you getback from break...

3/20/0820

Representational Schemes

• We’re going to make use of First OrderLogic (FOL) as our representationalframework Not because we think it’s perfect Many of the alternatives turn out to be either

too limiting or They turn out to be notational variants

3/20/0821

FOL

• Allows for… The analysis of truth conditions

Allows us to answer yes/no questions Supports the use of variables

Allows us to answer questions through the use ofvariable binding

Supports inference Allows us to answer questions that go beyond what

we know explicitly

Page 8: CSCI 5832 Natural Language Processingmartin/Csci5832/Slides/lecture_18.pdfLecture 18 3/20/08 2 Today 3/20 •Semantics 3/20/08 3 Transition ... Semantic Analysis •Compositional Analysis

8

3/20/0822

FOL

• This choice isn’t completely arbitrary ordriven by the needs of practicalapplications

• FOL reflects the semantics of naturallanguages because it was designed thatway by human beings

• In particular…

3/20/0823

Meaning Structure of Language

• The semantics of human languages… Display a basic predicate-argument structure Make use of variables Make use of quantifiers Use a partially compositional semantics

3/20/0824

Predicate-Argument Structure

• Events, actions and relationships can becaptured with representations that consistof predicates and arguments to thosepredicates.

• Languages display a division of laborwhere some words and constituentsfunction as predicates and some asarguments.

Page 9: CSCI 5832 Natural Language Processingmartin/Csci5832/Slides/lecture_18.pdfLecture 18 3/20/08 2 Today 3/20 •Semantics 3/20/08 3 Transition ... Semantic Analysis •Compositional Analysis

9

3/20/0825

Predicate-Argument Structure

• Predicates Primarily Verbs, VPs, PPs, Sentences Sometimes Nouns and NPs

• Arguments Primarily Nouns, Nominals, NPs, PPs But also everything else; as we’ll see it

depends on the context

3/20/0826

Example

• Mary gave a list to John.• Giving(Mary, John, List)• More precisely

Gave conveys a three-argument predicate The first arg is the subject The second is the recipient, which is

conveyed by the NP in the PP The third argument is the thing given,

conveyed by the direct object

3/20/0827

Not exactly

• The statement The first arg is the subject

can’t be right.• Subjects can’t be givers.• We mean that the meaning underlying the

subject phrase plays the role of the giver.

Page 10: CSCI 5832 Natural Language Processingmartin/Csci5832/Slides/lecture_18.pdfLecture 18 3/20/08 2 Today 3/20 •Semantics 3/20/08 3 Transition ... Semantic Analysis •Compositional Analysis

10

3/20/0828

Better

• Turns out this representation isn’t quite as useful asit could be. Giving(Mary, John, List)

• Better would be

3/20/0829

Predicates

• The notion of a predicate just got more complicated…• In this example, think of the verb/VP providing a

template like the following

• The semantics of the NPs and the PPs in the sentenceplug into the slots provided in the template

3/20/0830

Semantic Analysis

• Semantic analysis is the process of takingin some linguistic input and assigning ameaning representation to it. There a lot of different ways to do this that

make more or less (or no) use of syntax We’re going to start with the idea that syntax

does matter The compositional rule-to-rule approach

Page 11: CSCI 5832 Natural Language Processingmartin/Csci5832/Slides/lecture_18.pdfLecture 18 3/20/08 2 Today 3/20 •Semantics 3/20/08 3 Transition ... Semantic Analysis •Compositional Analysis

11

3/20/0831

Compositional Analysis

• Principle of Compositionality The meaning of a whole is derived from the

meanings of the parts• What parts?

The constituents of the syntactic parse of theinput

• What could it mean for a part to have ameaning?

3/20/0832

Example

• AyCaramba serves meat

3/20/0833

Compositional Analysis

Page 12: CSCI 5832 Natural Language Processingmartin/Csci5832/Slides/lecture_18.pdfLecture 18 3/20/08 2 Today 3/20 •Semantics 3/20/08 3 Transition ... Semantic Analysis •Compositional Analysis

12

3/20/0834

Augmented Rules

• We’ll accomplish this by attaching semantic formationrules to our syntactic CFG rules

• Abstractly

• This should be read as the semantics we attach to Acan be computed from some function applied to thesemantics of A’s parts.

3/20/0835

Example

• Easy parts… NP -> PropNoun NP -> MassNoun PropNoun -> AyCaramba MassMoun -> meat

• Attachments{PropNoun.sem}{MassNoun.sem}{AyCaramba}{MEAT}

3/20/0836

Example

• S -> NP VP• VP -> Verb NP• Verb -> serves

• {VP.sem(NP.sem)}• {Verb.sem(NP.sem)• ???

Page 13: CSCI 5832 Natural Language Processingmartin/Csci5832/Slides/lecture_18.pdfLecture 18 3/20/08 2 Today 3/20 •Semantics 3/20/08 3 Transition ... Semantic Analysis •Compositional Analysis

13

3/20/0837

Lambda Forms

• A simple addition to FOL Take a FOPC sentence

with variables in it that areto be bound.

Allow those variables to bebound by treating thelambda form as a functionwith formal arguments

3/20/0838

Example

3/20/0839

Example

Page 14: CSCI 5832 Natural Language Processingmartin/Csci5832/Slides/lecture_18.pdfLecture 18 3/20/08 2 Today 3/20 •Semantics 3/20/08 3 Transition ... Semantic Analysis •Compositional Analysis

14

3/20/0840

Example

3/20/0841

Example

3/20/0842

Next Time

Finish reading 17 and 18 for next time.Have a good break.