ANLP Tutorial Exercise Set 3 (for tutorial groups in week 6) WITH SOLUTIONS

Similar documents
11/29/2010. Statistical Parsing. Statistical Parsing. Simple PCFG for ATIS English. Syntactic Disambiguation

Syntax Parsing 1. Grammars and parsing 2. Top-down and bottom-up parsing 3. Chart parsers 4. Bottom-up chart parsing 5. The Earley Algorithm

Basic Parsing with Context-Free Grammars. Some slides adapted from Julia Hirschberg and Dan Jurafsky 1

CS 598 Natural Language Processing

Compositional Semantics

Grammars & Parsing, Part 1:

Context Free Grammars. Many slides from Michael Collins

ENGBG1 ENGBL1 Campus Linguistics. Meeting 2. Chapter 7 (Morphology) and chapter 9 (Syntax) Pia Sundqvist

Content Language Objectives (CLOs) August 2012, H. Butts & G. De Anda

Enhancing Unlexicalized Parsing Performance using a Wide Coverage Lexicon, Fuzzy Tag-set Mapping, and EM-HMM-based Lexical Probabilities

Informatics 2A: Language Complexity and the. Inf2A: Chomsky Hierarchy

Chapter 4: Valence & Agreement CSLI Publications

Parsing of part-of-speech tagged Assamese Texts

Proof Theory for Syntacticians

Introduction to HPSG. Introduction. Historical Overview. The HPSG architecture. Signature. Linguistic Objects. Descriptions.

Derivational: Inflectional: In a fit of rage the soldiers attacked them both that week, but lost the fight.

A Minimalist Approach to Code-Switching. In the field of linguistics, the topic of bilingualism is a broad one. There are many

Natural Language Processing. George Konidaris

UNIVERSITY OF OSLO Department of Informatics. Dialog Act Recognition using Dependency Features. Master s thesis. Sindre Wetjen

A Computational Evaluation of Case-Assignment Algorithms

Some Principles of Automated Natural Language Information Extraction

Ensemble Technique Utilization for Indonesian Dependency Parser

The Interface between Phrasal and Functional Constraints

The College Board Redesigned SAT Grade 12

Construction Grammar. University of Jena.

A Framework for Customizable Generation of Hypertext Presentations

Using dialogue context to improve parsing performance in dialogue systems

Part I. Figuring out how English works

Approaches to control phenomena handout Obligatory control and morphological case: Icelandic and Basque

Objectives. Chapter 2: The Representation of Knowledge. Expert Systems: Principles and Programming, Fourth Edition

CAAP. Content Analysis Report. Sample College. Institution Code: 9011 Institution Type: 4-Year Subgroup: none Test Date: Spring 2011

Dear Teacher: Welcome to Reading Rods! Reading Rods offer many outstanding features! Read on to discover how to put Reading Rods to work today!

Chunk Parsing for Base Noun Phrases using Regular Expressions. Let s first let the variable s0 be the sentence tree of the first sentence.

A Graph Based Authorship Identification Approach

"f TOPIC =T COMP COMP... OBJ

Developing Grammar in Context

Ch VI- SENTENCE PATTERNS.

An Interactive Intelligent Language Tutor Over The Internet

Pre-Processing MRSes

RANKING AND UNRANKING LEFT SZILARD LANGUAGES. Erkki Mäkinen DEPARTMENT OF COMPUTER SCIENCE UNIVERSITY OF TAMPERE REPORT A ER E P S I M S

Writing a composition

An Introduction to the Minimalist Program

Modeling Attachment Decisions with a Probabilistic Parser: The Case of Head Final Structures

LTAG-spinal and the Treebank

Efficient Normal-Form Parsing for Combinatory Categorial Grammar

COMPUTATIONAL COMPLEXITY OF LEFT-ASSOCIATIVE GRAMMAR

Basic Syntax. Doug Arnold We review some basic grammatical ideas and terminology, and look at some common constructions in English.

Case government vs Case agreement: modelling Modern Greek case attraction phenomena in LFG

AQUA: An Ontology-Driven Question Answering System

Achim Stein: Diachronic Corpora Aston Corpus Summer School 2011

Words come in categories

South Carolina English Language Arts

On-Line Data Analytics

Intra-talker Variation: Audience Design Factors Affecting Lexical Selections

Target Language Preposition Selection an Experiment with Transformation-Based Learning and Aligned Bilingual Data

Language Acquisition Fall 2010/Winter Lexical Categories. Afra Alishahi, Heiner Drenhaus

How to analyze visual narratives: A tutorial in Visual Narrative Grammar

SEMAFOR: Frame Argument Resolution with Log-Linear Models

Beyond the Blend: Optimizing the Use of your Learning Technologies. Bryan Chapman, Chapman Alliance

CAS LX 522 Syntax I. Long-distance wh-movement. Long distance wh-movement. Islands. Islands. Locality. NP Sea. NP Sea

The Strong Minimalist Thesis and Bounded Optimality

TA Script of Student Test Directions

Project in the framework of the AIM-WEST project Annotation of MWEs for translation

Graph Alignment for Semi-Supervised Semantic Role Labeling

Inleiding Taalkunde. Docent: Paola Monachesi. Blok 4, 2001/ Syntax 2. 2 Phrases and constituent structure 2. 3 A minigrammar of Italian 3

1/20 idea. We ll spend an extra hour on 1/21. based on assigned readings. so you ll be ready to discuss them in class

BULATS A2 WORDLIST 2

Chapter 9 Banked gap-filling

Character Stream Parsing of Mixed-lingual Text

Reinforcement Learning by Comparing Immediate Reward

Reading Grammar Section and Lesson Writing Chapter and Lesson Identify a purpose for reading W1-LO; W2- LO; W3- LO; W4- LO; W5-

CS Machine Learning

Developing True/False Test Sheet Generating System with Diagnosing Basic Cognitive Ability

Mathematics Success Grade 7

Guidelines for Writing an Internship Report

Facing our Fears: Reading and Writing about Characters in Literary Text

Developing a TT-MCTAG for German with an RCG-based Parser

a) analyse sentences, so you know what s going on and how to use that information to help you find the answer.

Towards a MWE-driven A* parsing with LTAGs [WG2,WG3]

Highlighting and Annotation Tips Foundation Lesson

What is this species called? Generation Bar Graph

Copyright Corwin 2015

Contents. Foreword... 5

Type Theory and Universal Grammar

Parsing natural language

The Effect of Multiple Grammatical Errors on Processing Non-Native Writing

ELA/ELD Standards Correlation Matrix for ELD Materials Grade 1 Reading

Lip reading: Japanese vowel recognition by tracking temporal changes of lip shape

Analysis of Probabilistic Parsing in NLP

Presentation skills. Bojan Jovanoski, project assistant. University Skopje Business Start-up Centre

Second Exam: Natural Language Parsing with Neural Networks

Machine Learning from Garden Path Sentences: The Application of Computational Linguistics

CSC200: Lecture 4. Allan Borodin

Mercer County Schools

Formulaic Language and Fluency: ESL Teaching Applications

A Grammar for Battle Management Language

Lecture 2: Quantifiers and Approximation

Underlying and Surface Grammatical Relations in Greek consider

Author: Fatima Lemtouni, Wayzata High School, Wayzata, MN

Loughton School s curriculum evening. 28 th February 2017

Transcription:

ANLP Tutorial Exercise Set 3 (for tutorial groups in week 6) WITH SOLUTIONS v1.1 School of Informatics, University of Edinburgh Henry Thompson, Sharon Goldwater This week s tutorial exercises focus on syntax, (English) grammar, and parsing, using both contextfree grammar and dependencies. After working through the exercises and discussing some additional issues in your tutorial groups, you should be able to: Provide examples showing how syntactic structure reflects the semantics of a sentence, and in particular, semantic ambiguity. You should also be able to explain and illustrate how constituency parses and dependency parses differ with respect to this issue. Provide the syntactic parse for simple sentences using either Universal Dependencies or context-free grammar rules. Hand-simulate the CKY parsing algorithm and transition-based dependency parsing, and by doing so, better understand some of the computational issues involved. 1 CFGs and attachment ambiguity When constructing a grammar and parsing with it, one important goal is to accurately reflect the meaning of sentences in the structure of the trees the grammar assigns to them. Assuming a compositional semantics, this means we would expect attachment ambiguity in the grammar to reflect alternative interpretations. The following two exercises aim to hone your intuitions about the syntax-semantics relationship. Exercise 1. In English, conjunctions often create attachment ambiguity, as in the sentence I like green eggs and ham. The ambiguity inside the noun phrase here could be captured by the following two context-free grammar rules, where Nom is a nominal (noun-like) category: Nom Adj Nom Nom Nom Conj Nom a) Write down two paraphrases of I like green eggs and ham, where each paraphrase unambiguously expresses one of the meanings. b) Draw two parse trees for just the Nom part of the sentence, illustrating the ambiguity. You ll also need to use a rule Nom N. Which tree goes with which paraphrase? Solution 1. a) I like ham and green eggs or I like green eggs and green ham. b) Respectively: Nom Nom Conj Nom Adj Nom and N Nom Adj Nom green Nom Conj Nom green N ham N and N eggs eggs ham 1

(A) PP P NP (B) PP (C) P NP (D) (E) PP PP Figure 1: Trees for exercise 2 Exercise 2. Another common source of attachment ambiguity in English is from prepositional phrases. The relevant grammar rules include: PP NP PP P NP Here are five verb phrases: (1) watched the comet from the roof with my telescope (2) watched the comet from the park across the street (3) watched a video by the BBC about the comet (4) watched a video about the expedition to the comet (5) watched a video about the comment on my mobile Figure 1 shows five partial trees. Match the phrases to the trees which best capture their meanings. You may find it helpful to ask yourself questions such as where did this event happen?, how was it done?, what was watched?. You may also want to try out (in pencil!) different ways of writing in phrases under the leaves of the various trees. Solution 2. 1E; 2A; 3D; 4C; 5B 2 CKY parsing Exercise 3. Assume we are using the following grammar: 2

S NP PP NP D N NP PP P NP V swam ran flew swam ran flew D the a an N pilot plane NP Edinburgh Glasgow P to a) Draw a 7x7 chart for the sentence the pilot flew the plane to Glasgow and fill it in using the CKY algorithm. Number the symbols you put in the matrix in the order they would be computed, assuming the grammar is searched top-to-bottom. b) How is the attachment ambiguity present in this sentence reflected in the chart at the end? Solution 3. a) Here is a picture of the chart. To avoid clutter I included the backpointers only for the final three items added (the s and S). The backpointers show the (i,j) indices for the pair of child cells. 1 2 3 4 5 6 7 the pilot flew the plane to Glasgow 0 1:D 9:NP 12:S 15:S 18:S [(0,2),(2,7)] 1 2:N 17: [(2,5),(5,7)] 2 3:V 4: 13: 16: [(2,3),(3,7)] 3 5:D 10:NP 14:NP 4 6:N 5 7:P 11:PP 6 8:NP b) The ambiguity isn t represented explicitly at the top node. However if we follow the backpointer, we see that there are two s in (2,7), which indicates two distinct subtrees (with different backpointers). It s actually important that we do not add a second S at the top: if we carried the ambiguity upward in this fashion, we could end up storing an exponential number of categories in each cell and this is exactly what we are trying to avoid. 3 Dependency syntax and parsing Exercise 4. a) Draw dependency parses for verb phrases (2) and (3) from exercise 2, using UD labels for the relations as illustrated in JM3. You shouldn t need to know any more labels than: nsubj, dobj, iobj,,,, amod. You should be able to figure out most of the labels by looking at examples from the textbook. For prepositional phrases, use the relation, as in these examples: 1 1 The textbook and this tutorial more or less follow the UD v1 guidelines; UD guidelines have now been updated for v2, so if you look online you may find discrepancies. 3

nsubj the man in the mirror he looked in the mirror Note that by convention, all dependency parses have a, whether or not it is the head of a full sentence. Also note that there s a mistake in JM3 figures 14.5, 14.6, and 14.15 where the (book me) relation should be labelled iobj and the (book flight) relation should be labelled dobj. b) Now try to draw a dependency parse for the sentence I like green eggs and ham. You will need to use the cc and conj labels (see examples in JM3, Fig 14.3). Do you run across any problems? Is it clear what the dependency structure should be? Is the ambiguity in this sentence represented in the dependency structure (or multiple structures), and if so how? Solution 4. a) The two trees are: dobj watched the comet from the park across the street dobj watched a video by the BBC about the comet b) The correct tree according to UD v1 guidelines (and following the textbook) is: nsubj dobj amod conj cc I like green eggs and ham There are several points worth noticing/discussing, including the following: Conjunction is inherently a symmetric relationship, but dependency grammar requires asymmetric relations. So it isn t a natural fit, and requires choosing one of the two conjuncts arbitrarily as the head for both the conj and cc relations. In fact UD v1 and v2 differ on what is the head of the cc relation! 4

There is only a single dependency parse for this sentence, even though there are two different meanings. So in this (unlike constituency structure) the dependency structure does not reflect the semantic ambiguity. You might have considered (or discussed in your group) whether there are alternative guidelines for parsing conjunctions that would reflect the ambiguity, or have a more symmetric relationship. For example, would it be reasonable to make and the head of the conjoined phrase, and would this solve any of the problems? What might a dependency-like structure look like that better captures the meaning where green modifies both eggs and ham? (It has two arcs pointing to green, which isn t a valid dependency tree. But some people have proposed that we should really be using dependency graphs, rather than trees. These would permit this kind of structure, but are much more difficult to deal with computationally, e.g. to design efficient parsing algorithms.) The main takeaway from this exercise is for you to understand some of the weaknesses of dependency structure. Exercise 5. Consider the following dependency-annotated sentence. (For simplicity, we leave out the relation labels in this exercise). the cat chased a dog By hand-simulating the algorithm for arc-standard transition-based parsing, show that there is more than one sequence of transitions that can lead to the correct parse of this sentence. How does this fact motivate the need for the procedure described in JM3 section 14.4.1 (generating the training oracle)? What is the sequence produced by the training oracle? Solution 5. Here are two possible sequences (you might find others). The first is the training oracle sequence, which chooses LEFTARC as soon as possible in all s. Step Stack Word list Action Relation added 0 [] [the, cat, chased, a, dog] SHIFT 1 [, the] [cat, chased, a, dog] SHIFT 2 [, the, cat] [chased, a, dog] LEFTARC (the cat) 3 [, cat] [chased, a, dog] SHIFT 4 [, cat, chased] [a, dog] LEFTARC (cat chased) 5 [, chased] [a, dog] SHIFT 6 [, chased, a] [dog] SHIFT 7 [, chased, a, dog] [] LEFTARC (a dog) 8 [, chased, dog] [] RIGHTARC (chased dog) 9 [, chased] [] RIGHTARC ( chased) 10 [] [] DONE 5

Step Stack Word list Action Relation added 0 [] [the, cat, chased, a, dog] SHIFT 1 [, the] [cat, chased, a, dog] SHIFT 2 [, the, cat] [chased, a, dog] LEFTARC (the cat) 3 [, cat] [chased, a, dog] SHIFT 4 [, cat, chased] [a, dog] SHIFT 5 [, cat, chased, a] [dog] SHIFT 6 [, cat, chased, a, dog] [] LEFTARC (a dog) 7 [, cat, chased, dog] [] RIGHTARC (chased dog) 8 [, cat, chased] [] LEFTARC (cat chased) 9 [, chased] [] RIGHTARC ( chased) 10 [] [] DONE The training oracle is needed in order to define a set of actions that will lead to a correct parse, and are also as consistent as possible. In other words, when we train the classifier to decide an action, we want the training data (sequences of configurations from the training oracle) to be as consistent as possible about what action is taken given a particular configuration or partial configuration, because consistent patterns are easier to learn than random ones. 6