ling 388 language and computers take-home final examination 12/9/03 sandiway fong
Post on 21-Dec-2015
214 views
TRANSCRIPT
LING 388Language and Computers
Take-Home Final ExaminationTake-Home Final Examination
12/912/9/03/03
Sandiway FONGSandiway FONG
Administrivia
Final Lecture Today:Final Lecture Today:
1.1. Topic ReviewTopic Review
2.2. Final Exam Final Exam Review of questionsReview of questions Ask clarification questions!Ask clarification questions!
3.3. Class SurveyClass Survey Office Hours (TA):Office Hours (TA):
This Friday 11-12:15 pm in Social Science 224 (the This Friday 11-12:15 pm in Social Science 224 (the computer lab)computer lab)
Administrivia
Final Examination RulesFinal Examination Rules Due Due exactlyexactly one week from today: one week from today:
NoonNoon Tuesday 16th Tuesday 16th NoNo late submissions will be accepted late submissions will be accepted
Answers submitted must be your answersAnswers submitted must be your answers TA (Charles) and instructor (me) available by email and in TA (Charles) and instructor (me) available by email and in
person (as practical) to answer your questions about the final person (as practical) to answer your questions about the final all weekall week
Attempt as many questions as you canAttempt as many questions as you can 46 pts on offer46 pts on offer You don’t have to answer all questions to receive full credit You don’t have to answer all questions to receive full credit
(30 pts)(30 pts)
Topics Covered
Goals of the course:Goals of the course: Introduction to computational linguisticsIntroduction to computational linguistics Ability to write grammarsAbility to write grammars Hands-on approachHands-on approach
Computer laboratory classes as well as regular lecturesComputer laboratory classes as well as regular lectures
HomeworksHomeworks Designed to be extensions of computer laboratory exercisesDesigned to be extensions of computer laboratory exercises
FinalFinal Test your understanding of the lecture material and the Test your understanding of the lecture material and the
homeworks (reviewed in class)homeworks (reviewed in class)
Topics Covered
Prolog (using SWI-Prolog)Prolog (using SWI-Prolog) Data Structures:Data Structures:
Atoms, variables, lists, structuresAtoms, variables, lists, structures Programs:Programs:
Facts, program clausesFacts, program clauses
Execution:Execution: Queries, unification, rules of inferenceQueries, unification, rules of inference Non-determinism, negationNon-determinism, negation
Built-ins: Built-ins: =.., var/1, findall/3 =.., var/1, findall/3 Definite Clause Grammar (DCG) rulesDefinite Clause Grammar (DCG) rules
Topics Covered
Chomsky Hierarchy (Level 3)Chomsky Hierarchy (Level 3) Regular expressions Regular expressions Regular grammarsRegular grammars
Right and left linear grammars Right and left linear grammars Finite State Automata (FSA) Finite State Automata (FSA) Equivalence and limitations of the three Equivalence and limitations of the three
frameworksframeworks Finite State Transducers (FST)Finite State Transducers (FST)
Topics Covered
Chomsky Hierarchy (Level 2)Chomsky Hierarchy (Level 2) Context-free grammars Context-free grammars Combining right and left linear grammars Combining right and left linear grammars DCG implementation DCG implementation Push-Down Automata (PDA)Push-Down Automata (PDA) Limitations of context-free grammarsLimitations of context-free grammars
Topics Covered
Chomsky Hierarchy (Level 1)Chomsky Hierarchy (Level 1) Context-sensitive grammars Context-sensitive grammars DCG implementation DCG implementation
Stopped here …Stopped here … Did not go on to discuss Chomsky Hierarchy Level 0 Did not go on to discuss Chomsky Hierarchy Level 0
akaaka General Rewrite Rule System General Rewrite Rule System
Topics Covered
Natural Language Grammars Natural Language Grammars Definite Clause Grammars (DCG)Definite Clause Grammars (DCG)
Acceptors Acceptors Recovery of structureRecovery of structure
Multiple parsesMultiple parses Idioms Idioms Logical Form output Logical Form output Feature propagation Feature propagation Constituent agreement: local and distantConstituent agreement: local and distant
Topics Covered
Natural Language Grammars: Advanced Natural Language Grammars: Advanced TopicsTopics Tree-Walking Tree-Walking Conditions on Representation: FiltersConditions on Representation: Filters Universally Quantified ConditionsUniversally Quantified Conditions
Implemented as negated existential conditionsImplemented as negated existential conditions Multiple ConstraintsMultiple Constraints
Stopped here…Stopped here… Tools necessary to implement constraints in linguistic Tools necessary to implement constraints in linguistic
theorytheory
Topics Covered
Shallow Parsing Shallow Parsing Part-of-speech (POS) taggingPart-of-speech (POS) tagging Transformation-Based Learning (Brill)Transformation-Based Learning (Brill) Stemming (Porter Stemmer) Stemming (Porter Stemmer) Noun CompoundingNoun Compounding
Example of a difficult and unsolved problemExample of a difficult and unsolved problem
Topics Covered
Stopped here…Stopped here… Many other topics: statistical methods, ontologies, Many other topics: statistical methods, ontologies,
machine translation, document summarization, machine translation, document summarization, information retrieval, discourse processing …information retrieval, discourse processing …
There are two advanced seminars offered next There are two advanced seminars offered next semestersemester If interested, talk to me for detailsIf interested, talk to me for details
Final Examination
Contents:Contents: 1. Chomsky Hierarchy Level 3 (7 pts)1. Chomsky Hierarchy Level 3 (7 pts) 2. Extension of Regular Grammars (5 pts)2. Extension of Regular Grammars (5 pts) 3. Chomsky Hierarchy Level 2 (7 pts)3. Chomsky Hierarchy Level 2 (7 pts) 4. Penetrable Idioms (5 pts)4. Penetrable Idioms (5 pts) 5. Grammar Rules (10 pts)5. Grammar Rules (10 pts) 6. Prolog and Logic (6 pts)6. Prolog and Logic (6 pts) 7. Porter Stemmer (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:Give a regular expression for the set:
{ab, abab, ababab, abababab, … }{ab, abab, ababab, abababab, … } (B) (3 pts) (B) (3 pts)
Give the finite state automata for the set in part Give the finite state automata for the set in part (A) (A)
(C) (3 pts)(C) (3 pts) Write a regular grammar for the set in part (A) Write a regular grammar for the set in part (A)
Question 2: On the Extension of Regular Grammars (5 pts)
L = { aL = { annbbnn | n >= 1 } cannot be encoded by a regular | n >= 1 } cannot be encoded by a regular grammargrammar We know We know LL can be encoded using regular grammar can be encoded using regular grammar
rules plus a counterrules plus a counter We know a counter can be implemented using calls to We know a counter can be implemented using calls to
Prolog arithmetic and allowing non-terminals to take an Prolog arithmetic and allowing non-terminals to take an argumentargument
Write a DCG for Write a DCG for LL using using onlyonly regular grammar rules plus regular grammar rules plus non-terminals that take an argumentnon-terminals that take an argument i.e. no calls to Prolog arithmetic in {…} permittedi.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 Consider the following encoding of natural numbers
using the successor function using the successor function ss 1 = s(0)1 = s(0) 2 = s(s(0))2 = s(s(0)) 3 = s(s(s(0))) and so on …3 = s(s(s(0))) and so on …
Use this encoding in your extra argumentUse this encoding in your extra argument
Question 3: Chomsky Hierarchy Level 2 (7 pts)
Consider the following set:Consider the following set: { ww{ wwRR | w | w {a,b} {a,b}++ } } ww is a string of non-zero length of a’s and b’s is a string of non-zero length of a’s and b’s wwRR = = ww in reverse string order, e.g. (abb) in reverse string order, e.g. (abb)RR = bba = bba
(A) (5 pts)(A) (5 pts) Give a DCG grammar for wwGive a DCG grammar for wwRR
(B) (2 pts)(B) (2 pts) Is wwIs wwRR encodable using a regular grammar? encodable using a regular grammar? Explain your answerExplain your answer
Question 4: Penetrable Idioms (5 pts)
DCG rules allow idiom chunk constituents to be encoded DCG rules allow idiom chunk constituents to be encoded using one rule, e.g. using one rule, e.g. kicked the bucketkicked the bucket
However, some idioms are not completely frozen:However, some idioms are not completely frozen: e.g. e.g.
take … advantage of NPtake … advantage of NP• John took John took somesome advantage of the offer advantage of the offer• John took John took fullfull advantage of the offer advantage of the offer• John took John took goodgood advantage of the offer advantage of the offer• John took John took littlelittle advantage of the offer advantage of the offer• *John took *John took the/anthe/an advantage of the offer advantage of the offer
Write a VP idiom DCG rule for Write a VP idiom DCG rule for take ... advantage oftake ... advantage of
Question 5: Grammar Rules (10 pts)
Verb SubcategorizationVerb Subcategorization GiveGive and and donatedonate are double object verbs are double object verbs
John gave [John gave [NPNP Mary] [ Mary] [NPNP a book] a book] John gave [John gave [NPNP a book] [ a book] [PPPP to Mary] to Mary] *John donated [*John donated [NPNP Mary] [ Mary] [NPNP a book] a book] John donated [John donated [NPNP a book] [ a book] [PPPP to Mary] to Mary]
Write a DCG parser for these examplesWrite a DCG parser for these examples Show the actual output of your program for these Show the actual output of your program for these
examples along with the whole DCG,examples along with the whole DCG, i.e. use copy and paste from your Prolog systemi.e. use copy and paste from your Prolog system
Question 5: Grammar Rules
Hint: Modify the following acceptor rulesHint: Modify the following acceptor rules vp --> v, np, pp.vp --> v, np, pp. vp --> v, np, np.vp --> v, np, np. pp --> p, np.pp --> p, np. v --> [give].v --> [give]. v --> [donate].v --> [donate].
Make sure your program returns the syntactic Make sure your program returns the syntactic structurestructure
Question 6: Prolog and Logic (6 pts)
UnificationUnification (2 pts) What does the query (2 pts) What does the query
?- a(X) =.. X.?- a(X) =.. X.instantiate X to? Explain your answer.instantiate X to? Explain your answer.
NegationNegation Suppose we have the following facts:Suppose we have the following facts:
b(1). b(2). b(3).b(1). b(2). b(3). (1 pt) What does ?- b(X). return?(1 pt) What does ?- b(X). return? (1 pt) What does ?- \+ b(X). return?(1 pt) What does ?- \+ b(X). return? (2 pts) What does ?- \+ \+ b(X). return? (2 pts) What does ?- \+ \+ b(X). return?
Explain your answer.Explain your answer.
Question 7: Porter Stemmer (6 pts)
What does the Porter Stemmer output for What does the Porter Stemmer output for the following words:the following words: (2 pts) (2 pts) AvailabilityAvailability (2 pts) (2 pts) ShippingShipping (2pts) (2pts) UnbelievableUnbelievable
Show the steps in your answerShow the steps in your answer