LING/C SC/PSYC 438/538 Midterm 10/11. Instructions It is recommended that you attempt all questions –Submit your answers in one file by to

Slides:



Advertisements
Similar presentations
Theory Of Automata By Dr. MM Alam
Advertisements

Regular Expressions and DFAs COP 3402 (Summer 2014)
Lecture # 8 Chapter # 4: Syntax Analysis. Practice Context Free Grammars a) CFG generating alternating sequence of 0’s and 1’s b) CFG in which no consecutive.
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 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.
1 Lecture 22 Myhill-Nerode Theorem –distinguishability –equivalence classes of strings –designing FSA’s –proving a language L is not regular.
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/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 8: 9/18.
LING/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 7: 9/11.
LING 388 Language and Computers Lecture 8 9/25/03 Sandiway FONG.
COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf of Monash University.
LING/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 6: 9/6.
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/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 16: 10/23.
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/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 15: 10/16.
LING 388 Language and Computers Lecture 9 9/30/03 Sandiway FONG.
Final Exam 438/538 Instructions –538 Answer all questions –438 You may omit one question –Answers (one file only, no attachments) state name and.
1 Regular Expressions/Languages Regular languages –Inductive definitions –Regular expressions syntax semantics Not covered in lecture.
LING 388 Language and Computers Lecture 6 9/18/03 Sandiway FONG.
Second lecture REGULAR EXPRESSION. Regular Expression.
Introduction. » How the course works ˃Homework ˃Project ˃Exams ˃Grades » prerequisite ˃CSCI 6441: Mandatory prerequisite ˃Take the prereq or get permission.
Mastering Char to ASCII AND DOING MORE RELATED STRING MANIPULATION Why VB.Net ?  The Language resembles Pseudocode - good for teaching and learning fundamentals.
Formal Methods in SE Theory of Automata Qasiar Javaid Assistant Professor Lecture # 06.
1 Software Systems Development CEN Spring 2011 TR 12:30 PM – 1:45 PM ENB 116 Instructor:Dr. Rollins Turner Dept. of Computer Science and Engineering.
Lecture # 19. Example Consider the following CFG ∑ = {a, b} Consider the following CFG ∑ = {a, b} 1. S  aSa | bSb | a | b | Λ The above CFG generates.
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.
1 Computability Five lectures. Slides available from my web page There is some formality, but it is gentle,
LING/C SC/PSYC 438/538 Lecture 12 10/4 Sandiway Fong.
1 Module 14 Regular languages –Inductive definitions –Regular expressions syntax semantics.
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?
LING/C SC/PSYC 438/538 Lecture 18 Sandiway Fong. Adminstrivia Homework 7 out today – due Saturday by midnight.
CST229 Week 7 Questions or concerns? Hand back Test#1 & Homework #4 – Test1 Average (45/50) Reading: Chapters 12&13 Chapter 12 – Grammar – production rules.
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.
Lecture # 4.
Mathematical Foundations of Computer Science Chapter 3: Regular Languages and Regular Grammars.
CSC312 Automata Theory Lecture # 8 Chapter # 5 (Cont…) Finite Automata.
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.
1 A well-parenthesized string is a string with the same number of (‘s as )’s which has the property that every prefix of the string has at least as many.
ICS 151 Digital Logic Design Spring 2004 Administrative Issues.
Lecture # 8 (Transition Graphs). Example Consider the language L of strings, defined over Σ={a, b}, having (containing) triple a or triple b. Consider.
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,[]).
Week 14 - Wednesday.  What did we talk about last time?  Exam 3 post mortem  Finite state automata  Equivalence with regular expressions.
Regular Languages REGULAR LANGUAGES (AKA TYPE 3) REGULAR GRAMMARS FINITE STATE MACHINES.
Recap lecture 5 Different notations of transition diagrams, languages of strings of even length, Odd length, starting with b, ending in a (with different.
LING/C SC/PSYC 438/538 Lecture 11 Sandiway Fong.
Pushdown Automata Reading: Chapter 6.
LING/C SC/PSYC 438/538 Lecture 17 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 19 Sandiway Fong.
Regular Expressions
LING/C SC/PSYC 438/538 Lecture 21 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 22 Sandiway Fong.
Midterm (Models of Computation, Fall, 2000)
LING/C SC/PSYC 438/538 Lecture 15 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 18 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 20 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 17 Sandiway Fong.
Recap Lecture 4 Regular expression of EVEN-EVEN language, Difference between a* + b* and (a+b)*, Equivalent regular expressions; sum, product and closure.
Presentation transcript:

LING/C SC/PSYC 438/538 Midterm 10/11

Instructions It is recommended that you attempt all questions –Submit your answers in one file by to –Write your name and 438 or 538 as the first line of the file –You have until the end of the class (1:45pm) –average time: 12.5 to 15 mins per question for 538 –You may consult the lecture slides and other resources on the web –You may not consult with one another (or anyone else) –However, you may ask me questions about the questions

Grading 438 –Answer 4 Questions correctly for an A –More than 4 = A* 538 –Answer 5 Questions correctly for an A –Answer all 6 correctly for A*

Question 1 Download the file wsj.txt (~ 50K lines) Write a Perl program that finds all lines containing any possible form of the idiom take... advantage of... How many are there in wsj.txt? Submit your program Submit the lines returned by your program

Question 2 Give a regular grammar in Prolog notation that accepts strings with an odd number of a’s (#a’s =1,3,5,...) followed by an even number of b’s (#b’s = 2,4,6,...) i.e. a n b m n odd, m even Examples: –aaabb –abbbb –aaaaabb –*aabb –*aaab Submit your program Show it works on the given examples

Question 3 Using an extra argument with regular grammar rules in Prolog DCG format, give a grammar that accepts L = a n b m n even (n=2,4,6,...) m is the odd number closest to but not exceeding n/2 Note: L is a non-regular language Examples: –aab –aaaab –*aaaabb –aaaaaabbb –*aaaaaabbbb –aaaaaaaabbb –*aaaaaaaabbbb –*aaaaaaaabbbbb Show your program works on the above examples

Question 4 Give a regexp for the language described in Question 2

Question 5 Give a regexp for the complement of the following FSA ba ab a b a,b a b

Question 6 Give the deterministic FSA corresponding to: