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

Slides:



Advertisements
Similar presentations
Review of Homework 4 November 20, Exercise 1 (A) 1 pt Modify the DCG to accept the omission of the complementizer that for object relative clauses.
Advertisements

CSA2050: DCG I1 CSA2050 Introduction to Computational Linguistics Lecture 8 Definite Clause Grammars.
LING 388: Language and Computers Sandiway Fong Lecture 9: 9/27.
LING 388: Language and Computers Sandiway Fong 9/29 Lecture 11.
LING 388: Language and Computers Sandiway Fong Lecture 15.
LING 438/538 Computational Linguistics Sandiway Fong Lecture 3: 8/29.
LING 388: Language and Computers Sandiway Fong Lecture 9: 9/22.
LING 438/538 Computational Linguistics Sandiway Fong Lecture 7: 9/12.
LING/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 10: 9/27.
LING 364: Introduction to Formal Semantics Lecture 10 February 14th.
LING 388 Language and Computers Lecture 2 9/04/03 Sandiway FONG.
LING 364: Introduction to Formal Semantics Lecture 9 February 9th.
LING 388 Language and Computers Lecture 19 11/04/03 Sandiway FONG.
LING/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 12: 10/4.
LING 438/538 Computational Linguistics Sandiway Fong Lecture 9: 9/21.
LING 388: Language and Computers Sandiway Fong Lecture 21: 11/7.
LING 388: Language and Computers Sandiway Fong Lecture 12: 10/5.
LING 388 Language and Computers Lecture 8 9/25/03 Sandiway FONG.
LING 438/538 Computational Linguistics Sandiway Fong Lecture 22: 11/15.
LING 364: Introduction to Formal Semantics Lecture 4 January 24th.
LING/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 9: 9/25.
LING/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 6: 9/6.
LING 364: Introduction to Formal Semantics Lecture 11 February 16th.
LING 438/538 Computational Linguistics Sandiway Fong Lecture 10: 9/26.
LING 388 Language and Computers Lecture 4 9/11/03 Sandiway FONG.
LING 438/538 Computational Linguistics Sandiway Fong Lecture 11: 10/3.
LING 388: Language and Computers Sandiway Fong Lecture 6: 9/13.
LING 388: Language and Computers Sandiway Fong Lecture 11: 10/3.
LING 388: Language and Computers Sandiway Fong Lecture 3: 8/29.
LING 438/538 Computational Linguistics Sandiway Fong Lecture 6: 9/7.
LING 388 Language and Computers Lecture 10 10/2/03 Sandiway FONG.
LING 388 Language and Computers Take-Home Final Examination 12/9/03 Sandiway FONG.
LING 364: Introduction to Formal Semantics Lecture 7 February 2nd.
LING 388 Language and Computers Lecture 20 11/6/03 Sandiway FONG.
LING 388 Language and Computers Lecture 18 10/30/03 Sandiway FONG.
LING 388: Language and Computers Sandiway Fong Lecture 17: 10/25.
LING 388 Language and Computers Lecture 16 10/23/03 Sandiway FONG.
LING 388: Language and Computers Sandiway Fong Lecture 10: 9/26.
LING 388 Language and Computers Lecture 7 9/23/03 Sandiway FONG.
LING/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 11: 10/2.
LING 438/538 Computational Linguistics Sandiway Fong Lecture 5: 9/5.
LING 388 Language and Computers Lecture 9 9/30/03 Sandiway FONG.
LING 388 Language and Computers Lecture 13 10/14/03 Sandiway FONG.
LING 364: Introduction to Formal Semantics Lecture 5 January 26th.
LING 388 Language and Computers Lecture 17 10/28/03 Sandiway FONG.
LING 388: Language and Computers Sandiway Fong Lecture 13: 10/10.
LING 388 Language and Computers Lecture 12 10/9/03 Sandiway FONG.
LING 388 Language and Computers Lecture 6 9/18/03 Sandiway FONG.
LING 388 Language and Computers Lecture 15 10/21/03 Sandiway FONG.
LING 388: Language and Computers Sandiway Fong Lecture 8.
LING 388: Language and Computers Sandiway Fong 10/4 Lecture 12.
LING 388: Language and Computers Sandiway Fong Lecture 11.
Context Free Grammars Reading: Chap 12-13, Jurafsky & Martin This slide set was adapted from J. Martin, U. Colorado Instructor: Paul Tarau, based on Rada.
LING 388: Language and Computers Sandiway Fong Lecture 17.
LING 388: Language and Computers Sandiway Fong Lecture 7.
LING 388: Language and Computers Sandiway Fong Lecture 18.
LING 388: Language and Computers Sandiway Fong Lecture 10.
LING 388: Language and Computers Sandiway Fong Lecture 19.
Context Free Grammars Reading: Chap 9, Jurafsky & Martin This slide set was adapted from J. Martin, U. Colorado Instructor: Rada Mihalcea.
LING 388: Language and Computers Sandiway Fong Lecture 13.
LING 388: Language and Computers Sandiway Fong Lecture 12.
Albert Gatt LIN3021 Formal Semantics Lecture 4. In this lecture Compositionality in Natural Langauge revisited: The role of types The typed lambda calculus.
LING 388: Language and Computers Sandiway Fong 9/27 Lecture 10.
Programming Languages and Design Lecture 3 Semantic Specifications of Programming Languages Instructor: Li Ma Department of Computer Science Texas Southern.
LING 388: Language and Computers Sandiway Fong Lecture 21.
LING/C SC/PSYC 438/538 Lecture 15 Sandiway Fong. Did you install SWI Prolog?
LING 388: Language and Computers Sandiway Fong Lecture 16.
LING/C SC/PSYC 438/538 Lecture 16 Sandiway Fong. SWI Prolog Grammar rules are translated when the program is loaded into Prolog rules. Solves the mystery.
LING/C SC/PSYC 438/538 Lecture 19 Sandiway Fong 1.
LING/C SC/PSYC 438/538 Lecture 21 Sandiway Fong.
Presentation transcript:

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

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

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

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

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?

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?

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

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

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

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)) --> [].

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

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) --> [].

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?

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

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

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