240 likes | 382 Views
LING 388 Language and Computers. Take-Home Final Examination 12/9 /03 Sandiway FONG. Administrivia. Final Lecture Today: Topic Review Final Exam Review of questions Ask clarification questions! Class Survey Office Hours (TA):
E N D
LING 388Language and Computers Take-Home Final Examination 12/9/03 Sandiway FONG
Administrivia • Final Lecture Today: • Topic Review • Final Exam • Review of questions • Ask clarification questions! • Class Survey • Office Hours (TA): • This Friday 11-12:15 pm in Social Science 224 (the computer lab)
Administrivia • 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: • 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) • 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) • 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) • 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) • 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 • 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 • 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 • 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… • Many other topics: statistical methods, ontologies, machine translation, document summarization, information retrieval, discourse processing … • There are two advanced seminars offered next semester • If interested, talk to me for details
Final Examination • 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) • Give a regular expression for the set: • {ab, abab, ababab, abababab, … } • (B) (3 pts) • Give the finite state automata for the set in part (A) • (C) (3 pts) • Write a regular grammar for the set in part (A)
Question 2: On the Extension of Regular Grammars (5 pts) • L = { anbn | 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 • i.e. no calls to Prolog arithmetic in {…} permitted
Question 2: On the Extension of Regular Grammars • 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: • { wwR | w e {a,b}+ } • w is a string of non-zero length of a’s and b’s • wR = w in reverse string order, e.g. (abb)R = bba • (A) (5 pts) • Give a DCG grammar for wwR • (B) (2 pts) • Is wwR encodable using a regular grammar? • Explain your answer
Question 4: Penetrable Idioms (5 pts) • DCG rules allow idiom chunk constituents to be encoded using one rule, e.g. kicked the bucket • However, some idioms are not completely frozen: • e.g. • take … advantage of NP • John took some advantage of the offer • John took full advantage of the offer • John took good advantage of the offer • John took little advantage of the offer • *John took the/an advantage of the offer • Write a VP idiom DCG rule for take ... advantage of
Question 5: Grammar Rules (10 pts) • 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 • 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 • (2 pts) What does the query • ?- a(X) =.. X. instantiate X to? Explain your answer. • 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: • (2 pts) Availability • (2 pts) Shipping • (2pts) Unbelievable • Show the steps in your answer