Presentation is loading. Please wait.

Presentation is loading. Please wait.

LING 388 Language and Computers Lecture 14 10/16/03 Sandiway FONG.

Similar presentations


Presentation on theme: "LING 388 Language and Computers Lecture 14 10/16/03 Sandiway FONG."— Presentation transcript:

1 LING 388 Language and Computers Lecture 14 10/16/03 Sandiway FONG

2 Administrivia Lecture 13 Slides on website Lecture 13 Slides on website  Truncated PDF file fixed Homework Assignment 3 Homework Assignment 3  Reminder:  Due next Tuesday  Need help or clarification?  Make an appointment with me or Charles

3 Homework 2 Review Exercise 2 Exercise 2 Two FSA for L = {a + b + }Two FSA for L = {a + b + } Implementation 1Implementation 1  s([a|L]) :- x(L).  x([a|L]) :- x(L).  x([b|L]) :- y(L).  y([]).  y([b|L]) :- y(L). Homework Question (C): Homework Question (C):  Explain the behavior of the programs on queries:  ?- s(L). and  ?- fsa(L). Implementation 2  startState(s).  endState(y).  transition(s,a,x).  transition(x,a,x).  transition(x,b,y).  transition(y,b,y).  fsa(L) :- startState(S), fsa(S,L).  fsa(S,[C|L]) :- transition(S,C,T), fsa(T,L).  fsa(S,[]) :- endState(S).

4 Homework 2 Review Exercise 3: Finite State Transducer Exercise 3: Finite State Transducer Implementation: Implementation:  a([y|L],M) :- b(L,M).  a([X|L],[X|M]) :- a(L,M).  b([],[i,e,s]). Homework Question: Homework Question:  How does the transducer handle “y” in ?-a([y,u,c,k,y],X). ? ab y : ies X : X

5 Homework 2 Review Exercise 4: Exercise 4:  Equivalent DCG for {a + b + }:  s --> [a], b.  b --> [a], b.  b --> [b], c.  b --> [b].  c --> [b], c.  c --> [b].  Homework Question:  What language does the sub-grammar starting with non-terminal b accept?

6 Homework 2 Review Exercise 5: Left and Right Recursive Rules Exercise 5: Left and Right Recursive Rules  DCG for {a n b n | n>=0}:  a --> [].  a --> [a], b.  b --> a, [b].  b --> [b].  Homework Question (B)  What happens to the query ?- a(X,[]). if we switch the order of the clauses for non-terminal a?

7 Empty Categories - Relative Clauses Introduction to empty categories Introduction to empty categories  Relative clauses:  The cat that I saw  I saw the cat  Verb subcategorization:  vp(vp(X,Y)) --> transitive_verb(X), np(Y).  transitive_verb(v(saw)) --> [saw]. Two options: Two options: 1. Write a special VP rule for transitive verbs in the case of object relatives 2. Write a NP -> rule … both options have advantages and disadvantages

8 Empty Categories - Relative Clauses Question: Question:  What kind of parse or output do we want to produce? Example: Example:  the cat that I saw  the cat i that I saw [ NP e i ]  (the cat)( x.I saw x)pseudo logical form Notes: Notes:  Logical form makes use of elements of mathematical lambda calculus notation  x introduces an (anonymous) function taking one argument x  Empty object [ NP e i ] interpreted as a logical variable x  Function application (  -reduction) suggested by NP ( x. …x…) notation Captures idea that x is the catCaptures idea that x is the cat

9 Empty Categories - Relative Clauses Example DCG rules: Example DCG rules:  np(X) --> det(Y), common_noun(Y), sbar(Z).  sbar(X) --> complementizer, s(Y).  complementizer --> [that].  s(s(X,Y)) --> np(X), vp(Y).  vp(vp(X,Y)) --> transitive_verb(X), np(Y).  np(X) --> []. Question: Question:  How should we instantiate the Xs in order to build some representation of (the cat)( x.I saw x) ?

10 Empty Categories - Relative Clauses Example DCG rules: Example DCG rules:  np(np(np(Y,Z),U)) --> det(Y), common_noun(Z), sbar(U).  sbar(lambda(x,Y)) --> complementizer, s(Y).  complementizer --> [that].  s(s(X,Y)) --> np(X), vp(Y).  vp(vp(X,Y)) --> transitive_verb(X), np(Y).  np(np(x)) --> [].

11 Empty Categories - Relative Clauses Prolog query: Prolog query:  ?- np(X,[the,cat,that,i,saw],[]). Result: Result:  X = np(np(det(the),n(cat)),lambda(x,s(np(i),vp(v(saw),np(x))))) np the cat x.I saw x

12 Empty Categories - Relative Clauses Bonus: Bonus:  DCG rule fragment will work also for the corresponding subject relative clause cases Example: Example:  the cat that saw me  the cat i that [ NP e i ] saw me  (the cat)( x. x saw me) Because in … Because in … s(s(X,Y)) --> np(X), vp(Y). the subject NP can also be expanded using the empty category rule np(X) --> [].

13 Empty Categories - Relative Clauses Problem 1: Incomplete Sentences Problem 1: Incomplete Sentences  NP -> is a context-free rule  i.e. may apply anywhere Impact of empty category rule on sentence construction: Impact of empty category rule on sentence construction:  John hit the ball  *Hit the ball  *John hit  *Hit  DCG rules will accept all these as sentences Question: Question:  How to prevent/control overgeneration?

14 Empty Categories - Relative Clauses Example: Example:  John hit the ball  *Hit the ball[ NP e i ] hit the ball  *John hitJohn hit [ NP e i ]  *Hit [ NP e i ] hit [ NP e i ] Filter: Filter:  All variables must be bound by an operator ( x) Example: Example:  *John hits(np(john),vp(v(hit),np(x)))

15 Empty Categories - Relative Clauses Problem 2: Incomplete Relative Clauses Problem 2: Incomplete Relative Clauses DCG fragment will also accept NPs of the form: DCG fragment will also accept NPs of the form:  *the cat that saw  *the cat that [ NP e i ] saw [ NP e i ]  (the cat)( x.x saw x)  i.e. the cat that saw itself Logical Form: Logical Form:  np(np(det(the),n(cat)),lambda(x,s(np(x),vp(v(saw),np(x))))) Filter: Filter:  Operator ( x) can only bind one variable

16 Next Time… We’ll look at how to write filters like the two introduced in this lecture: We’ll look at how to write filters like the two introduced in this lecture:  All variables must be bound by an operator ( x)  Operator ( x) can only bind one variable Note: Note:  Our two filters are reminiscent of the Bijection Principle (Koopman), basically that …  Operators and variables must be in one-to- one correspondence


Download ppt "LING 388 Language and Computers Lecture 14 10/16/03 Sandiway FONG."

Similar presentations


Ads by Google