Definite-Clause Grammars [Covington, 1994] Desislava Zhekova - - PowerPoint PPT Presentation

definite clause grammars covington 1994
SMART_READER_LITE
LIVE PREVIEW

Definite-Clause Grammars [Covington, 1994] Desislava Zhekova - - PowerPoint PPT Presentation

Outline Phrase Structure Top-Down Parsing DCG Rules Using DCG Parcers References Definite-Clause Grammars [Covington, 1994] Desislava Zhekova desi@linuxusers.de December 10, 2007 Desislava Zhekova Definite-Clause Grammars [Covington,


slide-1
SLIDE 1

Outline Phrase Structure Top-Down Parsing DCG Rules Using DCG Parcers References

Definite-Clause Grammars [Covington, 1994]

Desislava Zhekova

desi@linuxusers.de

December 10, 2007

Desislava Zhekova Definite-Clause Grammars [Covington, 1994]

slide-2
SLIDE 2

Outline Phrase Structure Top-Down Parsing DCG Rules Using DCG Parcers References

1 Phrase Structure 2 Top-Down Parsing 3 DCG Rules 4 Using DCG Parcers 5 References

Desislava Zhekova Definite-Clause Grammars [Covington, 1994]

slide-3
SLIDE 3

Outline Phrase Structure Top-Down Parsing DCG Rules Using DCG Parcers References Trees and PS Rules Phrase-Structure Formalism Recursion

S → NP VP NP → D N VP → V NP VP → V NP PP PP → P NP D → the D → a N → dog N → cat N → garden V → chased V → saw P → into

Desislava Zhekova Definite-Clause Grammars [Covington, 1994]

slide-4
SLIDE 4

Outline Phrase Structure Top-Down Parsing DCG Rules Using DCG Parcers References Trees and PS Rules Phrase-Structure Formalism Recursion

S → NP VP NP → D N VP → V NP VP → V NP PP PP → P NP D → the D → a N → dog N → cat N → garden V → chased V → saw P → into

Desislava Zhekova Definite-Clause Grammars [Covington, 1994]

slide-5
SLIDE 5

Outline Phrase Structure Top-Down Parsing DCG Rules Using DCG Parcers References Trees and PS Rules Phrase-Structure Formalism Recursion Desislava Zhekova Definite-Clause Grammars [Covington, 1994]

slide-6
SLIDE 6

Outline Phrase Structure Top-Down Parsing DCG Rules Using DCG Parcers References A Parsing Algorithm Parsing with Prolog Rules

BOTTOM-UP vs. TOP-DOWN

Desislava Zhekova Definite-Clause Grammars [Covington, 1994]

slide-7
SLIDE 7

Outline Phrase Structure Top-Down Parsing DCG Rules Using DCG Parcers References A Parsing Algorithm Parsing with Prolog Rules

S → NP VP s(L1, L) :- np(L1, L2), vp(L2, L).

Desislava Zhekova Definite-Clause Grammars [Covington, 1994]

slide-8
SLIDE 8

Outline Phrase Structure Top-Down Parsing DCG Rules Using DCG Parcers References A Parsing Algorithm Parsing with Prolog Rules

S → NP VP s(L1, L) :- np(L1, L2), vp(L2, L). L1-[the, dog, saw, the, cat] - the input string (IS) L2-[saw, the, cat] - the IS without the initial NP L-[ ] - the IS without the NP or the VP

Desislava Zhekova Definite-Clause Grammars [Covington, 1994]

slide-9
SLIDE 9

Outline Phrase Structure Top-Down Parsing DCG Rules Using DCG Parcers References A Parsing Algorithm Parsing with Prolog Rules

s(L1,L) :- np(L1,L2), vp(L2,L). np(L1,L) :- d(L1,L2), n(L2,L). vp(L1,L) :- v(L1,L2), np(L2,L). d([the|L],L). d([a|L],L). n([dog|L],L). n([cat|L],L). n([gardener|L],L). n([policeman|L],L). n([butler|L],L). v([chased|L],L). v([saw|L],L).

Desislava Zhekova Definite-Clause Grammars [Covington, 1994]

slide-10
SLIDE 10

Outline Phrase Structure Top-Down Parsing DCG Rules Using DCG Parcers References DCG Notation Example grammar in DCG notation Loops

What are DCG Rules?

Desislava Zhekova Definite-Clause Grammars [Covington, 1994]

slide-11
SLIDE 11

Outline Phrase Structure Top-Down Parsing DCG Rules Using DCG Parcers References DCG Notation Example grammar in DCG notation Loops

What are DCG Rules? nonterminal symbol - -> expansion

Desislava Zhekova Definite-Clause Grammars [Covington, 1994]

slide-12
SLIDE 12

Outline Phrase Structure Top-Down Parsing DCG Rules Using DCG Parcers References DCG Notation Example grammar in DCG notation Loops

What are DCG Rules? nonterminal symbol --> expansion, where expansion is: A nonterminal symbol such as np A list of terminal symbols A null constituent represented by [ ] A plain Prolog goal enclosed in braces {write (’Found NP’)} A series of any of these expansions joined by commas

Desislava Zhekova Definite-Clause Grammars [Covington, 1994]

slide-13
SLIDE 13

Outline Phrase Structure Top-Down Parsing DCG Rules Using DCG Parcers References DCG Notation Example grammar in DCG notation Loops

s

  • -> np, vp.

np --> d, n. vp --> v, np. d

  • -> [the]; [a].

n

  • -> [dog]; [cat]; [gardner]; [policeman]; [butler].

v

  • -> [chased]; [saw].

Desislava Zhekova Definite-Clause Grammars [Covington, 1994]

slide-14
SLIDE 14

Outline Phrase Structure Top-Down Parsing DCG Rules Using DCG Parcers References DCG Notation Example grammar in DCG notation Loops

A → A B

Desislava Zhekova Definite-Clause Grammars [Covington, 1994]

slide-15
SLIDE 15

Outline Phrase Structure Top-Down Parsing DCG Rules Using DCG Parcers References DCG Notation Example grammar in DCG notation Loops

A → A B NP → NP Conj NP NP → D N

Desislava Zhekova Definite-Clause Grammars [Covington, 1994]

slide-16
SLIDE 16

Outline Phrase Structure Top-Down Parsing DCG Rules Using DCG Parcers References DCG Notation Example grammar in DCG notation Loops

A → A B NP → NP Conj NP NP → NPX Conj NP NP → D N NP → NPX NPX → D N

Desislava Zhekova Definite-Clause Grammars [Covington, 1994]

slide-17
SLIDE 17

Outline Phrase Structure Top-Down Parsing DCG Rules Using DCG Parcers References Building Syntactic Trees Agreement Case Marking Subcategorization Undoing Syntactic Movements Separating Lexicons from PS Rules

s(np(d(the), n(cat)), vp(v(chased), np(d(the), n(dog)))

Desislava Zhekova Definite-Clause Grammars [Covington, 1994]

slide-18
SLIDE 18

Outline Phrase Structure Top-Down Parsing DCG Rules Using DCG Parcers References Building Syntactic Trees Agreement Case Marking Subcategorization Undoing Syntactic Movements Separating Lexicons from PS Rules

before translation s(a, b) --> np(c, d), vp(e, f). after translation s(a, b, L1, L2) --> np(c, d, L1, L2), vp(e, f, L2, L).

Desislava Zhekova Definite-Clause Grammars [Covington, 1994]

slide-19
SLIDE 19

Outline Phrase Structure Top-Down Parsing DCG Rules Using DCG Parcers References Building Syntactic Trees Agreement Case Marking Subcategorization Undoing Syntactic Movements Separating Lexicons from PS Rules

s(s(NP, VP))

  • -> np(NP), vp(VP).

np(np(D, N))

  • -> d(D),

n(N). vp(vp(V, NP)) --> v(V), np(NP). d(d(the))

  • -> [the].

n(n(dog))

  • -> [dog].

n(n(cat))

  • -> [cat].

v(v(chased))

  • -> [chased].

v(v(saw))

  • -> [saw].

Desislava Zhekova Definite-Clause Grammars [Covington, 1994]

slide-20
SLIDE 20

Outline Phrase Structure Top-Down Parsing DCG Rules Using DCG Parcers References Building Syntactic Trees Agreement Case Marking Subcategorization Undoing Syntactic Movements Separating Lexicons from PS Rules

The dog chases the cats. (Singular subject, singular verb) The dogs chase the cats. (Plural subject, plural verb) *The dog chase the cats. (Singular subject, plural verb) *The dogs chases the cats. (Plural subject, singular verb)

Desislava Zhekova Definite-Clause Grammars [Covington, 1994]

slide-21
SLIDE 21

Outline Phrase Structure Top-Down Parsing DCG Rules Using DCG Parcers References Building Syntactic Trees Agreement Case Marking Subcategorization Undoing Syntactic Movements Separating Lexicons from PS Rules

n(singular) --> [dog]; [cat]; [mouse]. n(plural)

  • -> [dogs]; [cats]; [mice].

v(singular) --> [chases]; [sees]. v(plural)

  • -> [chase]; [see].

np(Number) --> d, n(Number). vp(Number) --> v(Number), np(_). s --> np(Number), vp(Number).

Desislava Zhekova Definite-Clause Grammars [Covington, 1994]

slide-22
SLIDE 22

Outline Phrase Structure Top-Down Parsing DCG Rules Using DCG Parcers References Building Syntactic Trees Agreement Case Marking Subcategorization Undoing Syntactic Movements Separating Lexicons from PS Rules

He sees him. *Him sees he. She sees her. *Her sees she. They see them. *Them see they.

Desislava Zhekova Definite-Clause Grammars [Covington, 1994]

slide-23
SLIDE 23

Outline Phrase Structure Top-Down Parsing DCG Rules Using DCG Parcers References Building Syntactic Trees Agreement Case Marking Subcategorization Undoing Syntactic Movements Separating Lexicons from PS Rules

pronoun(singular, nominative) --> [he]; [she]. pronoun(singular, accusative) --> [him]; [her]. pronoun(plural, nominative) --> [they]. pronoun(plural, accusative) --> [them]. np(Number, Case) --> pronoun(Number, Case). np(Number, _)

  • -> d, n(Number).

s --> np(Number, nominative), vp(Number). vp(Number) --> v(Number), np(_, accusative).

Desislava Zhekova Definite-Clause Grammars [Covington, 1994]

slide-24
SLIDE 24

Outline Phrase Structure Top-Down Parsing DCG Rules Using DCG Parcers References Building Syntactic Trees Agreement Case Marking Subcategorization Undoing Syntactic Movements Separating Lexicons from PS Rules

VERB COMPLEMENT EXAMPLE sleep, bark None (The cat) slept. chase, see One NP (The dog) chased the cat. give, sell Two NPs (Max) sold Bill his car. say, claim Sentence (Max) claimed the cat barked.

Desislava Zhekova Definite-Clause Grammars [Covington, 1994]

slide-25
SLIDE 25

Outline Phrase Structure Top-Down Parsing DCG Rules Using DCG Parcers References Building Syntactic Trees Agreement Case Marking Subcategorization Undoing Syntactic Movements Separating Lexicons from PS Rules

VP → V VP → V NP VP → V NP NP VP → V S

Desislava Zhekova Definite-Clause Grammars [Covington, 1994]

slide-26
SLIDE 26

Outline Phrase Structure Top-Down Parsing DCG Rules Using DCG Parcers References Building Syntactic Trees Agreement Case Marking Subcategorization Undoing Syntactic Movements Separating Lexicons from PS Rules

VP → V1 VP → V2 NP VP → V3 NP NP VP → V4 S

Desislava Zhekova Definite-Clause Grammars [Covington, 1994]

slide-27
SLIDE 27

Outline Phrase Structure Top-Down Parsing DCG Rules Using DCG Parcers References Building Syntactic Trees Agreement Case Marking Subcategorization Undoing Syntactic Movements Separating Lexicons from PS Rules

vp --> v(1). vp --> v(2), np. vp --> v(3), np, np. vp --> v(4), s. v(1) --> [barked]; [slept]. v(2) --> [chased]; [saw]. v(3) --> [gave]; [sold]. v(4) --> [said]; [thought].

Desislava Zhekova Definite-Clause Grammars [Covington, 1994]

slide-28
SLIDE 28

Outline Phrase Structure Top-Down Parsing DCG Rules Using DCG Parcers References Building Syntactic Trees Agreement Case Marking Subcategorization Undoing Syntactic Movements Separating Lexicons from PS Rules

Max said Bill thought Joe believed Fido barked. Who said Bill thought Joe believed Fido barked? (Max.) Who did Max say ⊔ thought Joe believed Fido barked? (Bill.) Who did Max say Bill thought ⊔ believed Fido barked? (Joe.) Who did Max say Bill thought Joe believed ⊔ barked? (Fido.)

Desislava Zhekova Definite-Clause Grammars [Covington, 1994]

slide-29
SLIDE 29

Outline Phrase Structure Top-Down Parsing DCG Rules Using DCG Parcers References Building Syntactic Trees Agreement Case Marking Subcategorization Undoing Syntactic Movements Separating Lexicons from PS Rules

s(In,Out)-->[who,did],np([who|In]),Out1),vp(Out1,Out). np([who|Out], Out) --> [ ].

Desislava Zhekova Definite-Clause Grammars [Covington, 1994]

slide-30
SLIDE 30

Outline Phrase Structure Top-Down Parsing DCG Rules Using DCG Parcers References Building Syntactic Trees Agreement Case Marking Subcategorization Undoing Syntactic Movements Separating Lexicons from PS Rules

s(In, Out) --> np(In, Out1), vp(Out1, Out). np(X, X) --> [max]; [joe]; [bill]; [frido]. vp(X, X)

  • -> v.

vp(In, Out) --> v, np(In, Out). vp(In, Out) --> v, s(In, Out). v --> [saw]; [said]; [thought]; [believed]; [barked]. v --> [see]; [say]; [think]; [believe]; [bark].

Desislava Zhekova Definite-Clause Grammars [Covington, 1994]

slide-31
SLIDE 31

Outline Phrase Structure Top-Down Parsing DCG Rules Using DCG Parcers References Building Syntactic Trees Agreement Case Marking Subcategorization Undoing Syntactic Movements Separating Lexicons from PS Rules

n --> [X], (noun (X)). noun(dog). noun(cat). noun(gardener). . . .

Desislava Zhekova Definite-Clause Grammars [Covington, 1994]

slide-32
SLIDE 32

Outline Phrase Structure Top-Down Parsing DCG Rules Using DCG Parcers References

Covington, M. A. (1994). Natural Language Processing for Prolog Programmers. Prentice Hall, Englewood Cliffs.

Desislava Zhekova Definite-Clause Grammars [Covington, 1994]