Prolog programming: a do-it-yourself course for beginners Day 5 - - PowerPoint PPT Presentation

prolog programming a do it yourself course for beginners
SMART_READER_LITE
LIVE PREVIEW

Prolog programming: a do-it-yourself course for beginners Day 5 - - PowerPoint PPT Presentation

Prolog programming: a do-it-yourself course for beginners Day 5 Kristina Striegnitz Department of Computational Linguistics Saarland University, Saarbr ucken, Germany kris@coli.uni-sb.de http://www.coli.uni-sb.de/kris Day 5: Definite


slide-1
SLIDE 1

Prolog programming: a do-it-yourself course for beginners

Day 5

Kristina Striegnitz Department of Computational Linguistics Saarland University, Saarbr¨ ucken, Germany

kris@coli.uni-sb.de http://www.coli.uni-sb.de/˜kris

Day 5: Definite Clause Grammars (2) – p.1

slide-2
SLIDE 2

Day 5: Definite Clause Grammars (2)

Today: DCG parsers Reader: Lecture 8 of Learn Prolog Now!

Day 5: Definite Clause Grammars (2) – p.2

slide-3
SLIDE 3

Recognizers vs. Parsers

Is this [the,bride,kills,bill] a sentence? recognizer: yes parser: yes, and its structure is s np det the n bride vp vt kills np pn bill

Day 5: Definite Clause Grammars (2) – p.3

slide-4
SLIDE 4

Parse trees as complex terms

s np det the n bride vp vt kills np pn bill s( np( det(the), n(bride) ), vp( vt(kills), np( pn(bill) ) ) )

Day 5: Definite Clause Grammars (2) – p.4

slide-5
SLIDE 5

Constructing the parse tree

s --> np, vp. s(s(NPT,VPT)) --> np(NPT), vp(VPT). np --> det, n. np(np(DetT,NT)) --> det(DetT), n(NT). np --> pn. np(np(PNT)) --> pn(PNT). vp --> vi. vp(vp(ViT)) --> vi(ViT). vp --> vt, np. vp(vp(VtT,NPT)) --> vt(VtT), np(NPT). n --> [bride]. n(n(bride)) --> [bride]. n --> [nurse]. n(n(nurse)) --> [nurse]. det --> [the]. det(det(the)) --> [the]. pn --> [bill]. pn(pn(bill)) --> [bill]. vi --> [whistles]. vi(vi(whistles)) --> [whistles]. vt --> [kills]. vt(vt(kills)) --> [kills].

Day 5: Definite Clause Grammars (2) – p.5

slide-6
SLIDE 6

An example

det(T3,[the,bride,whistles],I2) n(T4,I2,I1) vp(T2,I1,[]) np(T1,[the,bride,whistles], I1) vp(T2,I1,[]) s(T,[the,bride,whistles],[]) vi(T5,[whistles],[]) T1=np(T3,T4) T=s(T1,T2) I2=[bride,kills,bill] T3=det(the) n(T4,[bride,whistles],I1) vp(T2,I1,[]) I1=[kills,bill] T4=n(bride) T2=vp(T5) vp(T2,[whistles],[]) T5=vi(whistles)

Day 5: Definite Clause Grammars (2) – p.6

slide-7
SLIDE 7

Practical Session

Write your own DCG.

http://www.coli.uni-sb.de/˜kris/esslli04prolog

Day 5: Definite Clause Grammars (2) – p.7