# LING 388 Language and Computers Take-Home Final Examination 12/9/03 Sandiway FONG.

## Presentation on theme: "LING 388 Language and Computers Take-Home Final Examination 12/9/03 Sandiway FONG."— Presentation transcript:

LING 388 Language and Computers Take-Home Final Examination 12/9/03 Sandiway FONG

Administrivia Final Lecture Today: Final Lecture Today: 1. Topic Review 2. Final Exam  Review of questions  Ask clarification questions! 3. Class Survey  Office Hours (TA):  This Friday 11-12:15 pm in Social Science 224 (the computer lab)

Administrivia Final Examination Rules Final Examination Rules  Due exactly one week from today:  Noon Tuesday 16th  No late submissions will be accepted  Answers submitted must be your answers  TA (Charles) and instructor (me) available by email and in person (as practical) to answer your questions about the final all week  Attempt as many questions as you can  46 pts on offer  You don’t have to answer all questions to receive full credit (30 pts)

Topics Covered Goals of the course: Goals of the course:  Introduction to computational linguistics  Ability to write grammars  Hands-on approach  Computer laboratory classes as well as regular lectures  Homeworks  Designed to be extensions of computer laboratory exercises  Final  Test your understanding of the lecture material and the homeworks (reviewed in class)

Topics Covered Prolog (using SWI-Prolog) Prolog (using SWI-Prolog)  Data Structures:  Atoms, variables, lists, structures  Programs:  Facts, program clauses  Execution:  Queries, unification, rules of inference  Non-determinism, negation  Built-ins:  =.., var/1, findall/3  Definite Clause Grammar (DCG) rules

Topics Covered Chomsky Hierarchy (Level 3) Chomsky Hierarchy (Level 3)  Regular expressions  Regular grammars  Right and left linear grammars  Finite State Automata (FSA)  Equivalence and limitations of the three frameworks  Finite State Transducers (FST)

Topics Covered Chomsky Hierarchy (Level 2) Chomsky Hierarchy (Level 2)  Context-free grammars  Combining right and left linear grammars  DCG implementation  Push-Down Automata (PDA)  Limitations of context-free grammars

Topics Covered Chomsky Hierarchy (Level 1) Chomsky Hierarchy (Level 1)  Context-sensitive grammars  DCG implementation Stopped here …  Did not go on to discuss Chomsky Hierarchy Level 0 aka General Rewrite Rule System

Topics Covered Natural Language Grammars Natural Language Grammars  Definite Clause Grammars (DCG)  Acceptors  Recovery of structure  Multiple parses  Idioms  Logical Form output  Feature propagation  Constituent agreement: local and distant

Topics Covered Natural Language Grammars: Advanced Topics Natural Language Grammars: Advanced Topics  Tree-Walking  Conditions on Representation: Filters  Universally Quantified Conditions  Implemented as negated existential conditions  Multiple Constraints Stopped here…  Tools necessary to implement constraints in linguistic theory

Topics Covered Shallow Parsing Shallow Parsing  Part-of-speech (POS) tagging  Transformation-Based Learning (Brill)  Stemming (Porter Stemmer)  Noun Compounding  Example of a difficult and unsolved problem

Topics Covered Stopped here… Stopped here…  Many other topics: statistical methods, ontologies, machine translation, document summarization, information retrieval, discourse processing … There are two advanced seminars offered next semester There are two advanced seminars offered next semester  If interested, talk to me for details

Final Examination

Contents: Contents:  1. Chomsky Hierarchy Level 3 (7 pts)  2. Extension of Regular Grammars (5 pts)  3. Chomsky Hierarchy Level 2 (7 pts)  4. Penetrable Idioms (5 pts)  5. Grammar Rules (10 pts)  6. Prolog and Logic (6 pts)  7. Porter Stemmer (6 pts)

Question 1: Chomsky Hierarchy Level 3(7pts) (A) (1 pt) (A) (1 pt)  Give a regular expression for the set:  {ab, abab, ababab, abababab, … } (B) (3 pts) (B) (3 pts)  Give the finite state automata for the set in part (A) (C) (3 pts) (C) (3 pts)  Write a regular grammar for the set in part (A)

Question 2: On the Extension of Regular Grammars (5 pts) L = { a n b n | n >= 1 } cannot be encoded by a regular grammar L = { a n b n | n >= 1 } cannot be encoded by a regular grammar  We know L can be encoded using regular grammar rules plus a counter  We know a counter can be implemented using calls to Prolog arithmetic and allowing non-terminals to take an argument Write a DCG for L using only regular grammar rules plus non-terminals that take an argument Write a DCG for L using only regular grammar rules plus non-terminals that take an argument  i.e. no calls to Prolog arithmetic in {…} permitted

Question 2: On the Extension of Regular Grammars Hint: Hint:  Consider the following encoding of natural numbers using the successor function s  1 = s(0)  2 = s(s(0))  3 = s(s(s(0))) and so on …  Use this encoding in your extra argument

Question 3: Chomsky Hierarchy Level 2 (7 pts) Consider the following set: Consider the following set:  { ww R | w  {a,b} + }  w is a string of non-zero length of a’s and b’s  w R = w in reverse string order, e.g. (abb) R = bba (A) (5 pts) (A) (5 pts)  Give a DCG grammar for ww R (B) (2 pts) (B) (2 pts)  Is ww R encodable using a regular grammar?  Explain your answer

Question 5: Grammar Rules(10 pts) Verb Subcategorization Verb Subcategorization  Give and donate are double object verbs  John gave [ NP Mary] [ NP a book]  John gave [ NP a book] [ PP to Mary]  *John donated [ NP Mary] [ NP a book]  John donated [ NP a book] [ PP to Mary]  Write a DCG parser for these examples  Show the actual output of your program for these examples along with the whole DCG,  i.e. use copy and paste from your Prolog system

Question 5: Grammar Rules Hint: Modify the following acceptor rules Hint: Modify the following acceptor rules  vp --> v, np, pp.  vp --> v, np, np.  pp --> p, np.  v --> [give].  v --> [donate].  Make sure your program returns the syntactic structure

Question 6: Prolog and Logic(6 pts) Unification Unification  (2 pts) What does the query  ?- a(X) =.. X. instantiate X to? Explain your answer. Negation Negation  Suppose we have the following facts:  b(1). b(2). b(3).  (1 pt) What does ?- b(X). return?  (1 pt) What does ?- \+ b(X). return?  (2 pts) What does ?- \+ \+ b(X). return? Explain your answer.

Question 7: Porter Stemmer (6 pts) What does the Porter Stemmer output for the following words: What does the Porter Stemmer output for the following words:  (2 pts) Availability  (2 pts) Shipping  (2pts) Unbelievable Show the steps in your answer Show the steps in your answer

Class Survey

Download ppt "LING 388 Language and Computers Take-Home Final Examination 12/9/03 Sandiway FONG."

Similar presentations