Computational Semantics Aljoscha Burchardt, Alexander Koller, Stephan Walter, Universität des Saarlandes,

Slides:



Advertisements
Similar presentations
Artificial Intelligence
Advertisements

Artificial Intelligence: Natural Language and Prolog
Problems of syntax-semantics interface ESSLLI 02 Trento.
Predicate Logic Colin Campbell. A Formal Language Predicate Logic provides a way to formalize natural language so that ambiguity is removed. Mathematical.
Prolog programming....Dr.Yasser Nada. Chapter 8 Parsing in Prolog Taif University Fall 2010 Dr. Yasser Ahmed nada prolog programming....Dr.Yasser Nada.
First-Order Logic.
October 2004CSA4050: Semantics III1 CSA4050: Advanced Topics in NLP Semantics III Quantified Sentences.
Natural Language Processing Lecture 2: Semantics.
CSA2050: DCG I1 CSA2050 Introduction to Computational Linguistics Lecture 8 Definite Clause Grammars.
First-Order Logic (and beyond)
CSA4050: Advanced Topics in NLP Semantics IV Partial Execution Proper Noun Adjective.
Resolution.
Semantics (Representing Meaning)
Translator Architecture Code Generator ParserTokenizer string of characters (source code) string of tokens abstract program string of integers (object.
Inference and Reasoning. Basic Idea Given a set of statements, does a new statement logically follow from this. For example If an animal has wings and.
CSA2050: DCG IV1 CSA2050: Definite Clause Grammars IV Handling Gaps II Semantic Issues.
Knowledge Representation Methods
LING 581: Advanced Computational Linguistics Lecture Notes April 23rd.
Outline Recap Knowledge Representation I Textbook: Chapters 6, 7, 9 and 10.
Computability and Complexity 8-1 Computability and Complexity Andrei Bulatov Logic Reminder.
LING 364: Introduction to Formal Semantics Lecture 4 January 24th.
CS 4705 Lecture 17 Semantic Analysis: Syntax-Driven Semantics.
Semantic Composition with -DRT Christof Rumpf Heinrich-Heine-Universität Düsseldorf
1 Relational Algebra and Calculus Yanlei Diao UMass Amherst Feb 1, 2007 Slides Courtesy of R. Ramakrishnan and J. Gehrke.
LING 364: Introduction to Formal Semantics Lecture 5 January 26th.
LING 388 Language and Computers Lecture 15 10/21/03 Sandiway FONG.
Adapted from Discrete Math
February 2009Introduction to Semantics1 Logic, Representation and Inference Introduction to Semantics What is semantics for? Role of FOL Montague Approach.
October 2004csa4050: Semantics II1 CSA4050: Advanced Topics in NLP Semantics II The Lambda Calculus Semantic Representation Encoding in Prolog.
The Relational Model: Relational Calculus
1st-order Predicate Logic (FOL)
CSE S. Tanimoto Lambda Calculus 1 Lambda Calculus What is the simplest functional language that is still Turing complete? Where do functional languages.
The Recursion Theorem Pages 217– ADVANCED TOPICS IN C O M P U T A B I L I T Y THEORY.
November 2003CSA4050: Semantics I1 CSA4050: Advanced Topics in NLP Semantics I What is semantics for? Role of FOL Montague Approach.
1 Natural Language Processing Lecture Notes 11 Chapter 15 (part 1)
Chapter 1, Part II: Predicate Logic With Question/Answer Animations.
CMPF144 FUNDAMENTALS OF COMPUTING THEORY Module 5: Classical Logic.
Formal Semantics Chapter Twenty-ThreeModern Programming Languages, 2nd ed.1.
October 2004CSA4050: Semantics III1 CSA4050: Advanced Topics in NLP Semantics III Quantified Sentences.
Computational Semantics Day 5: Inference Aljoscha.
1 Predicate (Relational) Logic 1. Introduction The propositional logic is not powerful enough to express certain types of relationship between propositions.
CS Introduction to AI Tutorial 8 Resolution Tutorial 8 Resolution.
Semantic Construction lecture 2. Semantic Construction Is there a systematic way of constructing semantic representation from a sentence of English? This.
Albert Gatt LIN3021 Formal Semantics Lecture 4. In this lecture Compositionality in Natural Langauge revisited: The role of types The typed lambda calculus.
1 Introduction to Computational Linguistics Eleni Miltsakaki AUTH Spring 2006-Lecture 8.
Key Concepts Representation Inference Semantics Discourse Pragmatics Computation.
Programming Languages and Design Lecture 3 Semantic Specifications of Programming Languages Instructor: Li Ma Department of Computer Science Texas Southern.
Computational Semantics Day II: A Modular Architecture
Dr. Muhammed Al-Mulhem ICS An Introduction to Logical Programming.
Automated Reasoning Early AI explored how to automated several reasoning tasks – these were solved by what we might call weak problem solving methods as.
November 2006Semantics I1 Natural Language Processing Semantics I What is semantics for? Role of FOL Montague Approach.
1 First order theories (Chapter 1, Sections 1.4 – 1.5) From the slides for the book “Decision procedures” by D.Kroening and O.Strichman.
1-1 An Introduction to Logical Programming Sept
Working with Discourse Representation Theory Patrick Blackburn & Johan Bos Lecture 2 Building Discourse Representation Structures.
Albert Gatt LIN3021 Formal Semantics Lecture 3. Aims This lecture is divided into two parts: 1. We make our first attempts at formalising the notion of.
April 2010Semantic Grammar1 A short guide to Blackburn’s Grammar of English.
2004/9/15fuzzy set theory chap02.ppt1 Classical Logic the forms of correct reasoning - formal logic.
CSE 425: Functional Programming I Programs as Functions Some programs act like mathematical functions –Associate a set of input values from the function’s.
Knowledge Representation Lecture 2 out of 5. Last Week Intelligence needs knowledge We need to represent this knowledge in a way a computer can process.
1 Interactive Computer Theorem Proving CS294-9 November 30, 2006 Adam Chlipala UC Berkeley Lecture 14: Twelf.
By P. S. Suryateja Asst. Professor, CSE Vishnu Institute of Technology
Semantics (Representing Meaning)
Natural Language Processing
1st-order Predicate Logic (FOL)
This Lecture Substitution model
CSE S. Tanimoto Lambda Calculus
Natural Language Processing
CSA4050: Advanced Topics in NLP
Introduction to Computational Linguistics
1st-order Predicate Logic (FOL)
Presentation transcript:

Computational Semantics Aljoscha Burchardt, Alexander Koller, Stephan Walter, Universität des Saarlandes, Saarbrücken, Germany ESSLLI 2004, Nancy, France

Computational Semantics How can we compute the meaning of e.g. an English sentence? –What do we mean by meaning? –What format should the result have? What can we do with the result?

The Big Picture Sentence: John smokes. Syntactic Analyses:S NPVP Johnsmokes Semantics Construction: smoke(j) Inference: x.smoke(x) snore(x),smoke(j) => snore(j)

Course Schedule Monday - Thursday: Semantics Construction –Mon.+Tue.: Lambda-Calculus –Wed.+Thu.: Underspecification Friday: Inference –(Semantic) Tableaux

The Book If you want to read more about computational semantics, see the forthcoming book: Blackburn & Bos, Representation and Inference: A first course in computational semantics. CSLI Press.

Today (Monday) Meaning Representation in FOL Basic Semantics Construction -Calculus Semantics Construction with Prolog

Meaning Representations Meaning representations of NL sentences First Order Logic (FOL) as formal language –John smokes. => smoke(j) –Sylvester loves Tweety. => love(s,t) –Sylvester loves every bird. => x.(bird(x) love(s,x))

In the Background: Model Theory x.(bird(x) love(s,x)) is a string again! Mathematically precise model representation, e.g.: {cat(s), bird(t), love(s,t), granny(g), own(g,s), own(g,t)} Inspect formula w.r.t. to the model: Is it true? Inferences can extract information: Is anyone not owned by Granny?

FOL Syntax (very briefly) FOL Formulae, e.g. x.(bird(x) love(s,x)) FOL Language –Vocabulary (constant symbols and predicate/relation symbols) –Variables –Logical Connectives –Quantifiers –Brackets, dots.

What we have done so far Meaning Representation in FOL Basic Semantics Construction -Calculus Semantics Construction with Prolog

Syntactic Analyses Basis: Context Free Grammar (CFG) Grammar Rules: S NP VP VP TV NP TV love NP johnLexical Rules / Lexicon NP mary...

Example: Syntactic Analyses

Example: Semantic Lexicon

Example: Semantics Construction

Compositionality The meaning of the sentence is constructed from: –The meaning of the words: john, mary, love(?,?) (lexicon) –Paralleling the syntactic construction (semantic rules)

Systematicity How do we know that e.g. the meaning of the VP loves Mary is constructed as love(?,mary) and not as love(mary,?) ? Better: How can we specify in which way the bits and pieces combine?

Systematicity (ctd.) Parts of formulae (and terms), e.g. for the VP love Mary? –love(?,mary) bad: not FOL –love(x,mary) bad: no control over free variable Familiar well-formed formulae (sentences): – x.love(x,mary) Everyone loves Mary. – x.love(mary,x) Mary loves someone.

Using Lambdas (Abstraction) Add a new operator to bind free variables: x.love(x,mary) to love Mary The new meta-logical symbol marks missing information in the object language ( -)FOL We abstract over x. How do we combine these new formulae and terms?

Super Glue Glueing together formulae/terms with a special x.love(x,mary)john Often written as x.love(x,mary)(john) How do we get back to the familiar love(john,mary) ?

Functional Application Glueing is known as Functional Application FA has the Form: FA triggers a very simple operation: Replace the -bound variable by the argument. => love(john,mary)

-Reduction/Conversion 1.Strip off the -prefix, 2.Remove the argument (and 3.Replace all occurences of the -bound variable by the argument. 2.love(x,mary) 3.love(john,mary)

Semantics Construction with Lambdas S: John loves Mary ( y TV: loves y x.love(x,y) NP: Mary mary NP: John john VP: loves Mary y

Example: Beta-Reduction ( y => ( => love(john,mary)

In the Background -Calculus –A logical standard technique offering more than - abstraction, and β-reduction. Other Logics –Higher Order Logics –Intensional Logics... For linguistics: Richard Montague (early seventies )

What we have done so far Meaning Representation in FOL Basic Semantics Construction -Calculus Semantics Construction with Prolog

Plan Next, we Introduce a Prolog represenation. Specify a syntax fragment with DCG. Add semantic information to the DCG. (Implement β-reduction.)

Prolog Representation: Terms and Formulae (man(john)&(~(love(mary,john)))) (happy(john)>(happy(mary)v(happy(fido))) forall(x,happy(x)) exists(y,(man(y)&(~(happy(y)))) lambda(x,…)

Prolog Representation: Operator Definitions :- application :- op(900,yfx,>).% implication :- op(850,yfx,v). % disjunction :- op(800,yfx,&). % conjunction :- op(750, fy,~). % negation forall(x,man(x)&~love(x,mary)>hate(mary,x)) (Mary hates every man that doesnt love her.) Binding Strength

Definite Clause Grammar Prologs built-in grammar formalism Example grammar: s --> np,vp. vp --> iv. vp --> tv,np.... np --> [john]. iv --> [smokes]. Call: s([john,smokes],[]).

Adding Semantics to DCG Adding an argument to each DCG rule to collect semantic information. Phrase rules of our first semantic DCG: --> np(NP),vp(VP). vp(IV) --> iv(IV). --> tv(TV),np(NP).

Lexicon Of Our First Semantic DCG np(john) --> [john]. np(mary) --> [mary]. iv(lambda(X,smoke(X))) --> [smokes],{vars2atoms(X)}. tv(lambda(X,lambda(Y,love(Y,X)))) --> [loves],{vars2atoms(X), vars2atoms(Y)}.

Running Our First Semantics Constrution ?- s(Sem,[mary,smokes],[]). Sem = lambda(v1, ?- …, betaConvert(Sem,Result). Result = smoke(mary) Note that we use some special predicates of freely available SWI Prolog (

betaConvert(Formula,Result) 1/2 betaConvert(Functor,lambda(X,Formula)), !, substitute(Arg,X,Formula,Substituted), betaConvert(Substituted,Result). 1.The input expression is of the form 2.The functor has (recursively) been reduced to lambda(X,Formula). Note that the code displayed in the reader is wrong. Corrected pages can be downloaded.

betaConvert(Formula,Result) 2/2 betaConvert(Formula,Result):- compose(Formula,Functor,Formulas), betaConvertList(Formulas,Converted), compose(Result,Functor,Converted). Formula= Functor = exists Formulas = Converted = [x,man(x)&walk(x)] Result = exists(x,man(x)&walk(x))

Helper Predicates betaConvertList([],[]). betaConvertList([F|R],[F_Res|R_Res]):- betaConvert(F,F_Res), betaConvertList(R,R_Res). compose(Term,Symbol,Args):- Term =.. [Symbol|Args]. substitute(…) ( Too much for a slide.)

Wrapping It Up go :- resetVars, readLine(Sentence), s(Formula,Sentence,[]), nl, print(Formula), betaConvert(Formula,Converted), nl, print(Converted).

Adding More Complex NPs NP: A man ~> x.man(x) S: A man loves Mary Lets try it in a system demo!

Tomorrow S: A man loves Mary ~> * love( x.man(x),mary) How to fix this. A DCG for a less trivial fragment of English. Real lexicon. Nice system architecture.