Computational Semantics - PowerPoint PPT Presentation

Computational semantics http www coli uni sb de cl projects milca esslli
1 / 39

  • Uploaded on
  • Presentation posted in: Funny / Jokes

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

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

Download Presentationdownload

Computational Semantics

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript

Computational semantics http www coli uni sb de cl projects milca esslli l.jpg

Computational Semantics

Aljoscha Burchardt,

Alexander Koller,

Stephan Walter,

Universität des Saarlandes,

Saarbrücken, Germany

ESSLLI 2004, Nancy, France

Computational semantics l.jpg

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 l.jpg

The Big Picture

  • Sentence: “John smokes”.

  • Syntactic Analyses:S



  • Semantics Construction: smoke(j)

  • Inference:x.smoke(x)snore(x),smoke(j)

    => snore(j)

Course schedule l.jpg

Course Schedule

  • Monday - Thursday: Semantics Construction

    • Mon.+Tue.: Lambda-Calculus

    • Wed.+Thu.: Underspecification

  • Friday: Inference

    • (Semantic) Tableaux

The book l.jpg

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 l.jpg

Today (Monday)

  • Meaning Representation in FOL

  • Basic Semantics Construction

  • -Calculus

  • Semantics Construction with Prolog

Meaning representations l.jpg

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 l.jpg

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 l.jpg

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 l.jpg

What we have done so far

  • Meaning Representation in FOL 

  • Basic Semantics Construction

  • -Calculus

  • Semantics Construction with Prolog

Syntactic analyses l.jpg

Syntactic Analyses

Basis: Context Free Grammar (CFG)

Grammar Rules:



TV  love

NP  johnLexical Rules / Lexicon

NP  mary


Example syntactic analyses l.jpg

Example: Syntactic Analyses

Example semantic lexicon l.jpg

Example: Semantic Lexicon

Example semantics construction l.jpg

Example: Semantics Construction

Example semantics construction15 l.jpg

Example: Semantics Construction

Compositionality l.jpg


The meaning of the sentence is constructed from:

  • The meaning of the words: john, mary, love(?,?) (lexicon)

  • Paralleling the syntactic construction (“semantic rules”)

Systematicity l.jpg


  • 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 l.jpg

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):

    • ,mary)“Everyone loves Mary.”

    • ,x) “Mary loves someone.”

Using lambdas abstraction l.jpg

Using Lambdas (Abstraction)

  • Add a new operator to bind free variables:

    ,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 l.jpg

Super Glue

  • Glueing together formulae/terms with a special symbol @:



  • Often written as ,mary)(john)

  • How do we get back to the familiar love(john,mary)?

Functional application l.jpg

Functional Application

  • “Glueing” is known as Functional Application

  • FA has the Form: Functor@Argument


  • FA triggers a very simple operation:

    Replace the -bound variable by the argument.

  • ,mary)@john

    => love(john,mary)

Reduction conversion l.jpg


  • Strip off the -prefix,

  • Remove the argument (and the @),

  • Replace all occurences of the -bound variable by the argument.


  • love(x,mary)@john

  • love(x,mary)

  • love(john,mary)

Semantics construction with lambdas l.jpg

Semantics Construction with Lambdas

S: John loves Mary


NP: John


VP: loves Mary


TV: loves


NP: Mary


Example beta reduction l.jpg

Example: Beta-Reduction


=> (,mary))@john

=> love(john,mary)

In the background l.jpg

In the Background

  • -Calculus

    • A logical standard technique offering more than -abstraction, functional @pplication and β-reduction.

  • Other Logics

    • Higher Order Logics

    • Intensional Logics

  • ...

  • For linguistics: Richard Montague (early seventies)

What we have done so far26 l.jpg

What we have done so far

  • Meaning Representation in FOL 

  • Basic Semantics Construction 

  • -Calculus 

  • Semantics Construction with Prolog

Slide27 l.jpg


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 l.jpg

Prolog Representation: Terms and Formulae






Prolog representation operator definitions l.jpg

Prolog Representation:Operator Definitions



:- op(950,yfx,@).% application

:- op(900,yfx,>).% implication

:- op(850,yfx,v).  % disjunction

:- op(800,yfx,&).   % conjunction

:- op(750, fy,~).   % negation


(„Mary hates every man that doesn‘t love her.“)

Definite clause grammar l.jpg

Definite Clause Grammar

  • Prolog‘s 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 l.jpg

Adding Semantics to DCG

  • Adding an argument to each DCG rule to collect semantic information.

  • Phrase rules of our first semantic DCG:

    s(VP@NP) --> np(NP),vp(VP).

    vp(IV) --> iv(IV).

    vp(TV@NP) --> tv(TV),np(NP).

Lexicon of our first semantic dcg l.jpg

Lexicon Of Our First Semantic DCG

np(john) --> [john].

np(mary) --> [mary].

iv(lambda(X,smoke(X))) -->


tv(lambda(X,lambda(Y,love(Y,X)))) -->



Running our first semantics constrution l.jpg

Running Our First Semantics Constrution

?- s(Sem,[mary,smokes],[]).

Sem = lambda(v1, smoke(v1))@mary

?- …, betaConvert(Sem,Result).

Result = smoke(mary)

Note that we use some special predicates of freely available SWI Prolog (

Betaconvert formula result 1 2 l.jpg

betaConvert(Formula,Result) 1/2


  • The input expression is of the form Functor@Arg.

  • 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 l.jpg

betaConvert(Formula,Result) 2/2




Formula= exists(x,man(x)&(lambda(z),walk(z)@x))

Functor = exists

Formulas = [x,man(x)&(lambda(z),walk(z)@x))]

Converted = [x,man(x)&walk(x)]

Result = exists(x,man(x)&walk(x))

Helper predicates l.jpg

Helper Predicates


betaConvertList([F|R],[F_Res|R_Res]):-        betaConvert(F,F_Res),        betaConvertList(R,R_Res).


Term =.. [Symbol|Args].

substitute(…) (Too much for a slide.)

Wrapping it up l.jpg

Wrapping It Up

go :-




nl, print(Formula),


nl, print(Converted).

Adding more complex nps l.jpg

Adding More Complex NPs

NP: A man ~> 

S: A man loves Mary

Let‘s try it in a system demo!

Tomorrow l.jpg


S: A man loves Mary

~> *love(,mary)

  • How to fix this.

  • A DCG for a less trivial fragment of English.

  • Real lexicon.

  • Nice system architecture.

  • Login