Presentation is loading. Please wait.

Presentation is loading. Please wait.

LING/C SC/PSYC 438/538 Lecture 26 Sandiway Fong.

Similar presentations


Presentation on theme: "LING/C SC/PSYC 438/538 Lecture 26 Sandiway Fong."— Presentation transcript:

1 LING/C SC/PSYC 438/538 Lecture 26 Sandiway Fong

2 Administrivia No new homework today

3 538 Presentations Tuesday: November 27th Thursday: November 29th
Scheduling Topic selection: already begun Talk length: 8 mins first come, first served basis me your 1st, 2nd and 3rd choices me your 1st, 2nd and 3rd choice of presentation dates: Tuesday: November 27th Thursday: November 29th Tuesday: December 4th

4 538 Presentations Check the table:

5 Left recursion and Prolog
Left recursive grammars: we know from an earlier lecture that left recursive rules are a no-no given Prolog’s left-to-right depth- first computation rule… s a ... Example: s --> a, [!]. a --> ba, [a]. a --> a, [a]. ba --> b, [a]. b --> [b]. ?- s([b,a,!],[]). ERROR: Out of local stack rule for nonterminal a immediately calls a

6 Preposition Phrase (PP) Attachment
The preferred syntactic analysis is a left recursive parse Examples: John saw the boy with a telescope (structural ambiguity: automatically handled by Prolog) withinstrument withpossessive

7 Preposition Phrase (PP) Attachment
The preferred syntactic analysis is a left recursive parse Can “stack” the PPs: John saw the boy with a limp with Mary with a telescope ambiguity: withpossessive , withaccompaniment, withinstrument

8 Preposition Phrase Attachment
Linguistically: PP (recursively) adjoins to NP or VP np(np(NP,PP)) --> np(NP), pp(PP). vp(vp(VP,PP)) --> vp(VP), pp(PP). Left recursion gives Prolog problems Derivation (top-down, left-to-right) sentential forms: vp vp pp vp pp pp vp pp pp pp vp pp pp pp pp infinite loop… Note: other extra arguments not shown here …

9 Transformation Apply the general transformation: to NP and VP rules:
np(np(DT,NN)) --> dt(DT,Number), nn(NN,Number). np(np(NP,PP)) --> np(NP), pp(PP). vp(vp(VBD,NP)) --> vbd(VBD), np(NP). vp(vp(VP,PP)) --> vp(VP), pp(PP). x(X) --> [z], w(X,x(z)). x(x(z)) --> [z]. w(W,X) --> [y], w(W,x(X,y)). w(x(X,y),X) --> [y]. Note: w is a fresh non-terminal that takes 2 arguments x(x(X,y)) --> x(X), [y]. x(x(z)) --> [z]. [z] [y] x x x is the recursive nonterminal [z] [y] x x Let's write a grammar!


Download ppt "LING/C SC/PSYC 438/538 Lecture 26 Sandiway Fong."

Similar presentations


Ads by Google