30
mputing Science, University of Aberdeen CS4025: Semantics Representing meaning Semantic interpretation Word meaning For more information: J&M, chap 14, 16 in 1 st ed; 17, 19 in 2 nd

CS4025: Semantics

Embed Size (px)

DESCRIPTION

CS4025: Semantics. Representing meaning Semantic interpretation Word meaning For more information: J&M, chap 14, 16 in 1 st ed; 17, 19 in 2 nd. NL Understanding. Understanding written text Which books are bestsellers Who wrote them For now, focus on “ AI ” approach - PowerPoint PPT Presentation

Citation preview

Page 1: CS4025: Semantics

Computing Science, University of Aberdeen 1

CS4025: Semantics

Representing meaning Semantic interpretation Word meaning

For more information: J&M, chap 14, 16 in 1st ed; 17, 19 in 2nd

Page 2: CS4025: Semantics

Computing Science, University of Aberdeen 2

NL Understanding

Understanding written text» Which books are bestsellers» Who wrote them

For now, focus on “AI” approach» explicit models of grammar, meaning, etc

Page 3: CS4025: Semantics

Computing Science, University of Aberdeen 3

Stages

Morphology: analyse word inflection Syntax: determine grammatical structure Semantics: convert to a form that is

meaningful to a computer» eg, SQL query

Pragmatics: influence of context» eg, what them refers to

Page 4: CS4025: Semantics

Computing Science, University of Aberdeen 4

Example

Original: Who wrote them morph: who write/past them Grammar: [verb=write, subject=who, object=them] semantics: Select title, firstname, lastname from [X] pragmatics:

» Select title, firstname, lastname from books» Where salesthisyear >10000

Page 5: CS4025: Semantics

Computing Science, University of Aberdeen 5

Definition

Semantic interpretation rewrites a parse tree into a “meaning representation”» Logic, SQL, knowledge base

Poorly understood compared to syntax» apps that need complex semantics, like database

front ends or high-quality MT, have had limited success in the past

Page 6: CS4025: Semantics

Computing Science, University of Aberdeen 6

Meaning

How can we represent the meaning of an English sentence?

Programming languages: “meaning” is the equivalent machine code

a = b +cmeans load a

add bstore c

We could represent meaning as programs in some language, in which case NLU would be a kind of “compilation”

Page 7: CS4025: Semantics

Computing Science, University of Aberdeen 7

Meaning Representation in NL

Many possibilities– executable programs– logical formulas– AI knowledge representation– nothing

No consensus on what is best - basic problem in philosophy and psychology

Page 8: CS4025: Semantics

Computing Science, University of Aberdeen 8

Criteria for an ideal MRL

Unambiguous Able to express all necessary shades of

meaning for the application domain Verifiability – system can tell whether a

statement is true according to a knowledge base

Canonical – different sentences with the same meaning are mapped to the same representation

Support of inference

Page 9: CS4025: Semantics

Computing Science, University of Aberdeen 9

Example: John passed CS1001

Different representations» Program: C (or SQL) code to add an appropriate

entry to a student database» Logic: pass(John, CS1001)» AI Semantic Net

Pass CS1001JohnAgent Object

Page 10: CS4025: Semantics

Computing Science, University of Aberdeen 10

Program as representation

Translate English into SQL (C, ...)» MS English Query / AccessELF

– “List the bestsellers” translated into “Select titles from books where sales>10000”

» Usually need a different translator for each application– Good authoring environments for semantic rules are

essential

Page 11: CS4025: Semantics

Computing Science, University of Aberdeen 11

Logic as a Representation

Translate into (first-order) logicJohn is a man man(John)John eats spinach eat(John,spinach)John sold all of his stocks(X)(stock(X) & own(John,X)) sell(John, X))John sold Peter all of his stocks(X)(stock(X) & own(John,X)) sell(John,X,Peter))

Page 12: CS4025: Semantics

Computing Science, University of Aberdeen 12

Logic as Representation (2)

Good points» Can represent any meaning (if you are inventive

enough about predicates etc.)» Good support for compositionality, arbitrarily

complex statements» Good support for quantifiers (all, some,...)

Bad points» Doesn’t seem to really match the way people think.

– does really mean some?

Page 13: CS4025: Semantics

Computing Science, University of Aberdeen 13

Case Frames as a Representation

Form of (AI) semantic network Assume verbs (and other words) are objects

with relationsAGENT - the person/thing actingTHEME - the person/thing acted uponBENEFICARY - [of action]AT-LOC - where action happened

Page 14: CS4025: Semantics

Computing Science, University of Aberdeen 14

Example

John gave Peter the ballJohn gave the ball to PeterThe ball was given to Peter by John

are all interpreted asGIVE

agent = Johntheme = ballbeneficiary = Peter

Page 15: CS4025: Semantics

Computing Science, University of Aberdeen 15

Meaning Primitives

Meaning primitives are a fixed set of concepts/ roles etc. in terms of which any meaning can be expressed

Makes reasoning, e.g. about whether two meanings are the same, simpler.

Example: PURCHASE actJohn bought the book from SamSam sold the book to John

Difficult to define small set of primitives» Conceptual Dependency was one serious attempt

Page 16: CS4025: Semantics

Computing Science, University of Aberdeen 16

Primitives» ATRANS - abstract transfer» PTRANS - physical transfer» MTRANS - mental transfer» PROPEL - apply force to an object» INGEST - eat, drink, etc» CON - conceptualise» etc

Conceptual Dependency

Page 17: CS4025: Semantics

Computing Science, University of Aberdeen 17

Example: "John bought a book from Mary."

(BI-CAUSE (SOURCE (ATRANS (ACTOR MARY) (OBJECT BOOK) (FROM MARY) (TO JOHN) (TIME PAST))) (TARGET (ATRANS (ACTOR JOHN) (OBJECT MONEY) (FROM JOHN) (TO MARY) (TIME PAST))))

Page 18: CS4025: Semantics

Computing Science, University of Aberdeen 18

Example: "Bob threw the ball to Bill."

(PTRANS (ACTOR BOB) (OBJECT BALL) (FROM BOB) (TO BILL) (TIME PAST) (INSTRUMENT (PROPEL (ACTOR BOB) (OBJECT BALL) (FROM BOB) (TO BILL) (TIME PAST)))

Page 19: CS4025: Semantics

Computing Science, University of Aberdeen 19

Knowledge Bases

Represent meaning using objects in a large AI knowledge base» CYC project - 15-year project to build a knowledge

base which holds the kind of general world knowledge that people have

» Use Cyc primitives and KR language to represent meaning?

Page 20: CS4025: Semantics

Computing Science, University of Aberdeen 20

MRLs and Logic

Most existing meaning representation languages

(frames, semantic nets, case frames etc). can be viewed as subsets of First Order Logic (where the expressive power is restricted or the set of predicates etc. is partially determined)

Main deficiencies of first order logic – inability to express default inferences and inferences based on partial information

Page 21: CS4025: Semantics

Computing Science, University of Aberdeen 21

Choosing an MRL: What is the Task?

Why are we processing this sentence? This could influence the kind of meaning representation chosen» database interface - perhaps use SQL rep?» AI system which reasons about John’s problems -

perhaps use logic or AI KR?» Information retrieval, speech dictation, grammar

checking - don’t build any meaning representation?

Page 22: CS4025: Semantics

Computing Science, University of Aberdeen 22

Semantic Interpretation

Rewriting the parse tree into the target representation

May be based on rewrite rules that insert a semantic structure X if the parse tree contains syntactic structure Y

For generality/coverage, needs to be compositional, that is the meaning of the whole is some fixed function of the meanings of the parts

More on this in the next lecture

Page 23: CS4025: Semantics

Computing Science, University of Aberdeen 23

Ex: List the books

S: imperativeV: ListNP: X

mapped into

Select X.<name> from X

There are also cheaper/simpler approaches to semantic interpretation in use…

Page 24: CS4025: Semantics

Computing Science, University of Aberdeen 24

An attempt to reduce the “distance” between syntactic and semantic representations

Grammar is defined in terms of semantic categories» TIMEQ-> When does FLIGHT-NP FLIGHT-VP» FLIGHT-NP -> Flight NUMBER» FLIGHT-NP -> Flight to CITY» FLIGHT-NP -> TIME flight to CITY» FLIGHT-VP -> depart» FLIGHT-VP -> leave

Semantic interpretation: Semantic grammar

Page 25: CS4025: Semantics

Computing Science, University of Aberdeen 25

Look for patterns (either in text or parse tree) which identify meaning fragments» Example: How much is a ticket to London?» How much specifies cost query» a ticket specifies a single one-way ticket» to London specifies destination

Must be in limited domain Patterns looked for can be informed by

knowledge about how words relate to underlying concepts and what syntactic properties words have.

Semantic Interpretation: Template spotting

Page 26: CS4025: Semantics

Computing Science, University of Aberdeen 26

Doctor-on-Board Problem

Simple rewriting may not be sufficient. Example:

– Is there a doctor within 200 miles of the Enterprise

» Database doesn’t have Doctor entities, instead it has DoctorOnBoard attr for ships

» Need to rephrase this as– Is there a ship within 200 miles of the Enterprise which

has a doctor on board?

» Restructure query from human’s data model to database’s data model

Distance between syntactic and semantic structure significant in this example

Page 27: CS4025: Semantics

Computing Science, University of Aberdeen 27

Lexical (Word) Meaning

Logic (classical) model» bachelor(X) = male(X) & adult(X) & ¬married(X)

– But: the pope? Divorcee? Muslim with 3 wives?» Father(X) = male(X)&parent(X)

– Man who adopts a child?– Sperm-bank donor?– Unmarried partner to woman raising a child?– Unmarried (gay) partner to man raising a child?

Prototype/exemplar models may be better when words don’t have formal “definitions”

Page 28: CS4025: Semantics

Computing Science, University of Aberdeen 28

Word meaning for time-series data

Weather reports» Saturday will be yet another generally dull day with

early morning mist or fog and mainly cloudy skies being prevalent. There will be the odd bright spell here and there, but it will feel rather damp with patches of mainly light rain to be found across many parts, especially the west and south.

Ongoing research project in CS Dept

Page 29: CS4025: Semantics

Computing Science, University of Aberdeen 29

Current Applications and Tasks

Meaning Representation Parsing SemEval-2016 Task 8: http://alt.qcri.org/semeval2016/task8/

C&C/Boxer: http://gmb.let.rug.nl/ Attempto Controlled English:

http://attempto.ifi.uzh.ch/site/

Would also want to do such semantic representations for Semantic Web applications.

Page 30: CS4025: Semantics

Computing Science, University of Aberdeen 30

Converting sentences to a “meaning representation” is hard» No agreement on best meaning-rep» Word meaning is hard to pin down

Limited success in small domains, but we can’t semantically interpret general text» but we can parse general text

Conclusion