LING 388: Language and Computers Sandiway Fong Lecture 21: 11/7.

Slides:



Advertisements
Similar presentations
LING/C SC/PSYC 438/538 Lecture 11 Sandiway Fong. Administrivia Homework 3 graded.
Advertisements

LING/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 13: 10/9.
LING/C SC/PSYC 438/538 Lecture 12 Sandiway Fong. Administrivia We'll postpone Homework 4 review until next week …
LING 388: Language and Computers Sandiway Fong Lecture 9: 9/27.
LING 388: Language and Computers Sandiway Fong 9/29 Lecture 11.
LING 438/538 Computational Linguistics Sandiway Fong Lecture 16: 10/19.
LING 438/538 Computational Linguistics Sandiway Fong Lecture 8: 9/29.
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/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 15: 10/17.
LING 388: Language and Computers Sandiway Fong Lecture 12: 10/5.
LING/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 8: 9/18.
LING 388 Language and Computers Lecture 8 9/25/03 Sandiway FONG.
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 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 438/538 Computational Linguistics Sandiway Fong Lecture 6: 9/7.
LING 388 Language and Computers Take-Home Final Examination 12/9/03 Sandiway FONG.
LING 438/538 Computational Linguistics Sandiway Fong Lecture 12: 10/5.
LING 388: Language and Computers Sandiway Fong Lecture 17: 10/25.
LING 388 Language and Computers Lecture 11 10/7/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 388: Language and Computers Sandiway Fong Lecture 16: 10/19.
LING 388 Language and Computers Lecture 9 9/30/03 Sandiway FONG.
CS 3240 – Chuck Allison.  A model of computation  A very simple, manual computer (we draw pictures!)  Our machines: automata  1) Finite automata (“finite-state.
LING 388: Language and Computers Sandiway Fong Lecture 17: 10/24.
LING 388 Language and Computers Lecture 12 10/9/03 Sandiway FONG.
Finite State Machines Data Structures and Algorithms for Information Processing 1.
LING 388 Language and Computers Lecture 6 9/18/03 Sandiway FONG.
LING/C SC/PSYC 438/538 Lecture 19 Sandiway Fong 1.
LING 388: Language and Computers Sandiway Fong Lecture 14 10/11.
LING/C SC/PSYC 438/538 Lecture 14 Sandiway Fong. Administrivia Midterm – This Wednesday – A bit like doing a homework in real time – Bring your laptop.
LING 388: Language and Computers Sandiway Fong Lecture 15 10/13.
Theory Of Automata By Dr. MM Alam
Lecture Two: Formal Languages Formal Languages, Lecture 2, slide 1 Amjad Ali.
Context Free Grammars CIS 361. Introduction Finite Automata accept all regular languages and only regular languages Many simple languages are non regular:
Grammars CPSC 5135.
Languages & Grammars. Grammars  A set of rules which govern the structure of a language Fritz Fritz The dog The dog ate ate left left.
LING/C SC/PSYC 438/538 Lecture 7 9/15 Sandiway Fong.
Introduction to Language Theory
Module 2 How to design Computer Language Huma Ayub Software Construction Lecture 8.
LING/C SC/PSYC 438/538 Lecture 12 10/4 Sandiway Fong.
LING 388: Language and Computers Sandiway Fong Lecture 11: 10/4.
LING 388: Language and Computers Sandiway Fong 9/27 Lecture 10.
LING/C SC/PSYC 438/538 Lecture 13 Sandiway Fong. Administrivia Reading Homework – Chapter 3 of JM: Words and Transducers.
LING/C SC/PSYC 438/538 Lecture 14 Sandiway Fong. Administrivia Homework 6 graded.
LING/C SC/PSYC 438/538 Lecture 15 Sandiway Fong. Did you install SWI Prolog?
Three Basic Concepts Languages Grammars Automata.
Mathematical Foundations of Computer Science Chapter 3: Regular Languages and Regular Grammars.
Nondeterministic Finite Automata (NFAs). Reminder: Deterministic Finite Automata (DFA) q For every state q in Q and every character  in , one and only.
BİL711 Natural Language Processing1 Regular Expressions & FSAs Any regular expression can be realized as a finite state automaton (FSA) There are two kinds.
LING/C SC/PSYC 438/538 Lecture 19 Sandiway Fong 1.
Theory of Languages and Automata By: Mojtaba Khezrian.
CSCI 2670 Introduction to Theory of Computing September 16, 2004.
LING/C SC/PSYC 438/538 Lecture 17 Sandiway Fong. Last Time Talked about: – 1. Declarative (logical) reading of grammar rules – 2. Prolog query: s(String,[]).
Complexity and Computability Theory I
LING/C SC/PSYC 438/538 Lecture 21 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 17 Sandiway Fong.
Context-Free Languages
Regular Grammar.
Intro to Data Structures
LING/C SC/PSYC 438/538 Lecture 21 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 22 Sandiway Fong.
Language Recognition (12.4)
Presentation transcript:

LING 388: Language and Computers Sandiway Fong Lecture 21: 11/7

2 Administrivia homework 6 –grammar programming –due Thursday lab class Thursday –Social Sciences 224

3 Review exploring questions of formal equivalence Regular Grammars FSARegular Expressions NDFSA FSA with -transitions x --> y, [t]. x --> [t]. (left recursive) or x --> [t], y. x --> [t]. (right recursive)

4 Review exploring questions of formal equivalence Regular Grammars (ND)FSA equivalent (right-recursive) regular grammar s --> [b], x. x --> [a], y. y --> [!]. y --> [a], y. sx z b ! y a a > Prolog FSA s([b|L]) :- x(L). x([a|L]) :- y(L). y([a|L]) :- y(L). y([‘!’|L]) :- z(L). z([]). queries ?- s(L). ?- s(L,[]). equivalent all the way down to when they output answers and loop

5 Review exploring questions of formal equivalence Regular Grammars s bx a y a y ! s !x ay a y b right recursive regular grammar s(s(b,X)) --> [b], x(X). x(x(a,Y)) --> [a], y(Y). y(y(!)) --> [!]. y(y(a,Y)) --> [a], y(Y). left recursive regular grammar s(s(X,!)) --> x(X),[!]. x(x(Y,a)) --> y(Y),[a]. y(y(b)) --> [b]. y(y(Y,a)) --> y(Y),[a]. same query ?- s(P,[b,a,a,!],[]). X = s(b,x(a,y(a,y(!)))) X = s(x(y(y(b),a),a),!) then semicolon ;( more answers ) terminates infinite loop

6 Last Time exploring questions of formal equivalence Regular Grammars the determiner-noun system –the man/men –a man/*a men DCG np(np(Y)) --> pronoun(Y). np(np(D,N)) --> det(D,Number), common_noun(N,Number). det(det(the),sg) --> [the]. det(det(the),pl) --> [the]. det(det(a),sg) --> [a]. common_noun(n(ball),sg) --> [ball]. common_noun(n(man),sg) --> [man]. common_noun(n(men),pl) --> [men]. pronoun(i) --> [i]. pronoun(we) --> [we]. DCG regular grammar equivalent np(np(i)) --> [i]. np(np(we)) --> [we]. np(np(the,N)) --> [the], common_nounsg(N). np(np(the,N)) --> [the], common_nounpl(N). np(np(a,N)) --> [a], common_nounsg(N). common_nounsg(n(ball)) --> [ball]. common_nounsg(n(man)) --> [man]. common_nounpl(n(men)) --> [men].

7 Determiner-Noun Agreement by extension –this determiner-noun system also has a FSA encoding determiner-noun regular grammar np(np(i)) --> [i]. np(np(we)) --> [we]. np(np(the,N)) --> [the], common_nounsg(N). np(np(the,N)) --> [the], common_nounpl(N). np(np(a,N)) --> [a], common_nounsg(N). common_nounsg(n(ball)) --> [ball]. common_nounsg(n(man)) --> [man]. common_nounpl(n(men)) --> [men]. np i common_nounsg > we the a ball man common_nounpl the men note: machine is a NDFSA. can be transformed into a deterministic machine

8 Determiner-Noun Agreement NDFSA ➟ FSA –set-of-states construction determiner-noun regular grammar np(np(i)) --> [i]. np(np(we)) --> [we]. np(np(the,N)) --> [the], common_nounsg(N). np(np(the,N)) --> [the], common_nounpl(N). np(np(a,N)) --> [a], common_nounsg(N). common_nounsg(n(ball)) --> [ball]. common_nounsg(n(man)) --> [man]. common_nounpl(n(men)) --> [men]. np i common_nounsg > we the a ball man common_nounpl the men np i common_nounsg > we a ball man {common_nounpl, common_nounsg} the men man ball

9 Determiner-Noun Agreement equivalence instantiated Regular Grammars FSARegular ExpressionsNDFSA FSA with -transitions np i common_nounsg > we a ball man {common_nounpl, common_nounsg} the men man ball np i common_nounsg > we the a ball man common_nounpl the men np(np(i)) --> [i]. np(np(we)) --> [we]. np(np(the,N)) --> [the], common_nounsg(N). np(np(the,N)) --> [the], common_nounpl(N). np(np(a,N)) --> [a], common_nounsg(N). common_nounsg(n(ball)) --> [ball]. common_nounsg(n(man)) --> [man]. common_nounpl(n(men)) --> [men]. we|i|(a (ball|man))|(the (ball|man|men))

10 Limits of Finite State Technology In general, it’s not true that grammars can always be rewritten into regular grammar form (and therefore simulatable by FSA)

11 Limits of Finite State Technology language = set of strings case 1 –suppose set is finite –e.g. L = {ba, abc, ccb, dd} easy to encode as a FSA (by closure under union) case 2 –set is infinite –... s1s1 s2s2 s3s3 ab s1s1 s2s2 s3s3 ba s4s4 c s1s1 s2s2 s3s3 cc s4s4 b s1s1 s2s2 s3s3 dd s0s0 ε ε ε ε

12 Limits of Finite State Technology Language = set of strings case 2 –set is infinite –e.g. L = a + b + – = { ab, aab, abb, aabb, aaab, abbb, … } “ one or more a ’ s followed by one or more b ’ s ” we know this set is regular –however, consider –L = {a n b n | n ≥ 1} – = { ab, aabb, aaabbb, aaaabbbb, … } “ the same number of b ’ s as a ’ s …” this set is not regular. Why? answer lies in the nature of the recursion sx y a a b b

13 The Limits of Finite State Technology [Aside: we can use the Pumping Lemma to prove this particular case.] informally, –we can build FSA for … –ab –aabb –aaabbb –… ab aabb aaabbb = end state

14 The Limits of Finite State Technology we can merge the individual FSA for … –ab –aabb –aaabbb aaabbb bb b such direct encoding would require an infinite number of states –and we ’ re using Finite State Automata quite different from the infinity obtained by looping –freely iterate (no counting)

15 The Limits of Finite State Technology example –L = a + b + = { ab, abb, aab, aabb, aaab, abbb, … } –“ one or more a ’ s followed by one or more b ’ s ” Note: –can be divided into two independent halves –each half can be replaced by iteration s1s1 s2s2 s3s3 ba s1s1 s2s2 s3s3 aa s4s4 b s1s1 s2s2 s3s3 ba s4s4 b s1s1 s2s2 s3s3 aa s4s4 b s5s5 b s1s1 s2s2 s3s3 aa s4s4 a s5s5 b s1s1 s2s2 s3s3 ba s4s4 b s5s5 b

16 The Limits of Finite State Technology example –L = a + b + = { ab, abb, aab, aabb, aaab, abbb, … } –“ one or more a ’ s followed by one or more b ’ s ” Note: –can be divided into two independent halves –each half can be replaced by iteration s1s1 s2s2 s3s3 ba s1s1 s2s2 s3s3 aa s4s4 b s1s1 s2s2 s3s3 ba s4s4 b s1s1 s2s2 s3s3 aa s4s4 b s5s5 b s1s1 s2s2 s3s3 aa s4s4 a s5s5 b s1s1 s2s2 s3s3 ba s4s4 b s5s5 b s1s1 s2s2 s3s3 ba s4s4 b s1s1 s2s2 s3s3 aa s4s4 b s5s5 b s0s0 ε ε s1s1 s2s2 s3s3 aa s4s4 a s5s5 b s6s6 b s0s0 ε ε s1s1 s2s2 s3s3 aa s4s4 a s5s5 b s6s6 bb s7s7 s1s1 s2s2 s3s3 aa s4s4 a s5s5 b b s3s3 s4s4 a s5s5 b b a

17 Distance and Finite State Limits Does linear distance between dependent elements create machines with impractically large number of states? Subject-Verb number agreement –The men were... –The man was... –The men forced from their homes were... –The man forced from his home was... (Miller and Chomsky 1963) –The people who called and wanted to rent your house when you go away next year are from California –need “memory” –14 words separating people from are

18 Distance and Finite State Limits (Miller and Chomsky 1963) –The people/person who called and wanted to rent your house when you go away next year are/is from California –need “memory” –14 words separating people from are from (Coleman 2005)

19 Next Time Back to writing grammars... –building sentence meaning –next step towards our translator