Ambiguity Management in Deep Grammar Engineering Tracy Holloway King.

Slides:



Advertisements
Similar presentations
Computational language: week 10 Lexical Knowledge Representation concluded Syntax-based computational language Sentence structure: syntax Context free.
Advertisements

Lexical Functional Grammar : Grammar Formalisms Spring Term 2004.
Grammar Development Platform Miriam Butt October 2002.
Grammatical Relations and Lexical Functional Grammar Grammar Formalisms Spring Term 2004.
Universität des Saarlandes Seminar: Recent Advances in Parsing Technology Winter Semester Jesús Calvillo.
For Monday Read Chapter 23, sections 3-4 Homework –Chapter 23, exercises 1, 6, 14, 19 –Do them in order. Do NOT read ahead.
Generation Miriam Butt January The Two Sides of Generation 1) Natural Language Generation (NLG) Systems which take information from some database.
Probabilistic Parsing: Enhancements Ling 571 Deep Processing Techniques for NLP January 26, 2011.
Albert Gatt LIN3022 Natural Language Processing Lecture 8.
Amirkabir University of Technology Computer Engineering Faculty AILAB Efficient Parsing Ahmad Abdollahzadeh Barfouroush Aban 1381 Natural Language Processing.
Sag et al., Chapter 4 Complex Feature Values 10/7/04 Michael Mulyar.
Issues in Computational Linguistics: Parsing and Generation Dick Crouch and Tracy King.
Issues in Computational Linguistics: Grammar Engineering Dick Crouch and Tracy King.
Features and Unification
Linguistics 187 Week 4 Ambiguity and Robustness. Discourse Language has pervasive ambiguity  walk untieable knot bank ? Noun or Verb (untie)able or un(tieable)?
1 Kakia Chatsiou Department of Language and Linguistics University of Essex XLE Tutorial & Demo LG517. Introduction to LFG Introduction.
Semi-Automatic Learning of Transfer Rules for Machine Translation of Low-Density Languages Katharina Probst April 5, 2002.
CS 4705 Lecture 11 Feature Structures and Unification Parsing.
Stochastic POS tagging Stochastic taggers choose tags that result in the highest probability: P(word | tag) * P(tag | previous n tags) Stochastic taggers.
1 Basic Parsing with Context Free Grammars Chapter 13 September/October 2012 Lecture 6.
SI485i : NLP Set 9 Advanced PCFGs Some slides from Chris Manning.
11 CS 388: Natural Language Processing: Syntactic Parsing Raymond J. Mooney University of Texas at Austin.
Feature structures and unification Attributes and values.
1 Features and Unification Chapter 15 October 2012 Lecture #10.
9/8/20151 Natural Language Processing Lecture Notes 1.
Probabilistic Parsing Reading: Chap 14, Jurafsky & Martin This slide set was adapted from J. Martin, U. Colorado Instructor: Paul Tarau, based on Rada.
For Friday Finish chapter 23 Homework: –Chapter 22, exercise 9.
Invitation to Computer Science, Java Version, Second Edition.
1 Statistical Parsing Chapter 14 October 2012 Lecture #9.
Te Kaitito A dialogue system for CALL Peter Vlugter, Alistair Knott, and Victoria Weatherall Department of Computer Science School of Māori, Pacific, and.
Lesson 3 CDT301 – Compiler Theory, Spring 2011 Teacher: Linus Källberg.
Grammar Engineering: What is it good for? Miriam Butt (University of Konstanz) and Martin Forst (NetBase Solutions) Colombo 2014.
May 2006CLINT-LN Parsing1 Computational Linguistics Introduction Parsing with Context Free Grammars.
1 Compiler Construction (CS-636) Muhammad Bilal Bashir UIIT, Rawalpindi.
CS 4705 Lecture 19 Word Sense Disambiguation. Overview Selectional restriction based approaches Robust techniques –Machine Learning Supervised Unsupervised.
A Cascaded Finite-State Parser for German Michael Schiehlen Institut für Maschinelle Sprachverarbeitung Universität Stuttgart
인공지능 연구실 황명진 FSNLP Introduction. 2 The beginning Linguistic science 의 4 부분 –Cognitive side of how human acquire, produce, and understand.
11 Chapter 14 Part 1 Statistical Parsing Based on slides by Ray Mooney.
Issues in Computational Linguistics: Ambiguity Management Dick Crouch and Tracy King.
1 Compiler Construction (CS-636) Muhammad Bilal Bashir UIIT, Rawalpindi.
Rules, Movement, Ambiguity
CS412/413 Introduction to Compilers and Translators Spring ’99 Lecture 3: Introduction to Syntactic Analysis.
Decision Trees Binary output – easily extendible to multiple output classes. Takes a set of attributes for a given situation or object and outputs a yes/no.
MedKAT Medical Knowledge Analysis Tool December 2009.
Supertagging CMSC Natural Language Processing January 31, 2006.
Natural Language Processing Lecture 15—10/15/2015 Jim Martin.
CPSC 422, Lecture 27Slide 1 Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 27 Nov, 16, 2015.
CS 4705 Lecture 17 Semantic Analysis: Robust Semantics.
Concepts and Realization of a Diagram Editor Generator Based on Hypergraph Transformation Author: Mark Minas Presenter: Song Gu.
/02/20161 Probabilistic Context Free Grammars Chris Brew Ohio State University.
NATURAL LANGUAGE PROCESSING
Chapter 11: Parsing with Unification Grammars Heshaam Faili University of Tehran.
A Simple English-to-Punjabi Translation System By : Shailendra Singh.
Data Mining CH6 Implementation: Real machine learning schemes(2) Reporter: H.C. Tsai.
Syntax Analysis Or Parsing. A.K.A. Syntax Analysis –Recognize sentences in a language. –Discover the structure of a document/program. –Construct (implicitly.
Roadmap Probabilistic CFGs –Handling ambiguity – more likely analyses –Adding probabilities Grammar Parsing: probabilistic CYK Learning probabilities:
Introduction to Parsing
Natural Language Processing Vasile Rus
Lecture – VIII Monojit Choudhury RS, CSE, IIT Kharagpur
Introduction to Parsing (adapted from CS 164 at Berkeley)
Basic Parsing with Context Free Grammars Chapter 13
Probabilistic and Lexicalized Parsing
Compiler Design 4. Language Grammars
CSCI 5832 Natural Language Processing
Probabilistic and Lexicalized Parsing
Parsing and More Parsing
Lecture 7: Introduction to Parsing (Syntax Analysis)
Problem Solving Skill Area 305.1
Parsing Unrestricted Text
Presentation transcript:

Ambiguity Management in Deep Grammar Engineering Tracy Holloway King

Ambiguity: bug or feature? Bug in computer programming languages Feature in natural language –People good at resolving ambiguity in context –Ambiguity consequently often unperceived “Readjust paper holding clip” even though thousand-fold ambiguities are common –Ambiguity promotes conciseness Computers can’t resolve ambiguity like humans If we are going to build large-scale, linguistically sophisticated grammars, we need ways to handle ambiguity

Talk Outline Sources of ambiguity Grammar engineering approaches –Shallow markup –(Dis)preference marks Stochastic disambiguation Efficiency in ambiguity management

Sources of Ambiguity Phonetic: –“I scream” or “ice cream” Tokenization: –“I like Jan.” --- |Jan|. Or |Jan.|. (abbrev January) Morphological: –“walks” --- plural noun or 3sg verb –“untieable knot” --- un(tieable) or (untie)able Lexical: –“bank” --- river bank or financial institution Syntactic: –“The turkeys are ready to eat.” --- fattened or hungry Semantic: –“Two boys ate fifteen pizzas.” each or 15 total Pragmatic: –“Sue won. Ed gave her a good luck charm.” --- cause or result

PP Attachment A classic example of syntactic ambiguity PP adjuncts can attach to VPs and NPs Strings of PPs in the VP are ambiguous –I see the girl with the telescope. I see [the girl with the telescope]. I see [the girl] [with the telescope]. Ambiguities proliferate exponentially –I see the girl with the telescope in the park I see [the girl with [the telescope in the park]] I see [the [girl with the telescope] in the park] I see the girl [with the [telescope in the park]] I see the girl [with the telescope] [in the park] I see [the girl with the telescope] [in the park] –The syntax has no way to determine the attachment, even if humans can.

Coverage entails ambiguity I fell in the park. + I know the girl in the park. I see the girl in the park.

Ambiguity can be explosive If alternatives multiply within or across components… TokenizeMorphologySyntax Semantics Discourse

Ambiguity figures Deep grammars are massively ambiguous Example: 700 from section 23 of WSJ –average # of words: 19.6 –average # of optimal parses: 684 »for 1-10 word sentences: 3.8 »for word sentences: 25.2 »for word sentences: 12,888

Managing Ambiguity Grammar engineering approaches –Trim early with shallow markup –(Dis)preference marks on rules Choose most probable parse for applications that need a single input Use packing to parse and manipulate the ambiguities efficiently

Talk Outline Sources of ambiguity Grammar engineering approaches –Shallow markup –(Dis)preference marks Stochastic disambiguation Efficiency in ambiguity management

Shallow markup Part of speech marking as filter I saw her duck/VB. –accuracy of tagger (v. good for English) –can use partial tagging (verbs and nouns) Named entities – Goldman, Sachs & Co. bought IBM. –good for proper names and times –hard to parse internal structure Fall back technique if fail –slows parsing –accuracy vs. speed

Example shallow markup: Named entities Allow tokenizer to accept marked up input: parse { Mr. Thejskt Thejs arrived.} tokenized string: Mr. Thejskt Thejs TB +NEperson Mr( TB ). TB Thejskt TB Thejs TB arrived TB. TB Add lexical entries and rules for NE tags

Resulting C-structure

Resulting F-structure

Results for shallow markup Full/All% Full parses Optimal sol’ns Best F-sc Time % Unmarked76482/175382/7965/100  Named ent 78263/147786/8460/91 POS tag62248/191676/7240/48 Kaplan and King 2003

(Dis)preference marks (OT marks) Want to (dis)prefer certain constructions –prefer: use when possible –disprefer: do not use unless no other analysis Implementation –Put marks in rules and lexical entries –Rank those marks »ranking can be different for different grammars/corpora –Use most prefered parse(s) »can use as a two pass system for robust parsing

Ungrammatical input Real world text contains ungrammatical input –Deep grammars tend to only cover grammatical output Common errors can be coded in the rules –may want to know that error occurred (e.g., provide feedback in CALL grammars) Disprefer parses of ungrammatical structures –tools for grammar writer to rank rules –two+ pass system 1.standard rules 2.rules for known ungrammatical constructions 3.default fall back rules

Sample ungrammatical structures Mismatched subject-verb agreement Verb3Sg = { SUBJ PERS = 3 SUBJ NUM = sg |BadVAgr } Missing copula VPcop ==> { Vcop: ^=! |e: (^ PRED )='NullBe ' MissingCopularVerb} { NP: (^ XCOMP)=! |AP: (^ XCOMP)=! | …}

Dispreferred grammatical structures Prefer subcategorized infinitives to adverbials –I want it. I finished up (in order) to leave. –I want it to leave. VP --> V (NP: (^ OBJ)=!) (VPinf: { (^ XCOMP)=! +InfSubcat |! $ (^ ADJUNCT) InfAdjunct } ). Post-copular gerunds –He is a boy. (His) going is difficult. –He is going.

OT Mark summary Use (dis)preference marks to (dis)prefer constructions or words Allows inclusion of marginal/ungrammatical constructions Issues: –Only works with ambiguities with known preferences (not PP attachment) –Hard to determine ranking for many marks –Two-pass parsing can be slow

Talk Outline Sources of ambiguity Grammar engineering approaches –Shallow markup –(Dis)preference marks Stochastic disambiguation Efficiency in ambiguity management

Packing & Pruning in XLE XLE produces (too) many candidates –All valid (with respect to grammar and OT marks) –Not all equally likely –Some applications require a single best parse or at most just a handful (n best) Grammar writer can’t specify correct choices –Many implicit properties of words and structures with unclear significance

Pruning in XLE Appeal to probability model to choose best parse Assume: previous experience is a good guide for future decisions Collect corpus of training sentences, build probability model that optimizes for previous good results –partially labelled training data is ok [NP-SBJ They] see [NP-OBJ the girl with the telescope] Apply model to choose best analysis of new sentences –efficient (XLE English grammar: 5% of parse time)

Exponential models are appropriate (aka Maximum Entropy or Log-linear models) Assign probabilities to representations, not to choices in a derivation No independence assumption Arithmetic combined with human insight –Human: »Define properties of representations that may be relevant »Based on any computable configuration of features, trees –Arithmetic: »Train to figure out the weight of each property

Properties employed in WSJ Experiment ~800 property-functions: –c-structure nodes and subtrees –recursively embedded phrases –f-structure attributes (grammatical functions) –atomic attribute-value pairs –left/right branching –(non)parallelism in coordination –lexical elements (subcategorization frames) Some end up with no discrimination power after training

Stochastic Disambiguation Summary Training: –Define a set of features by hand –Train on partially labelled data –Can train on low-ambiguity data Use: –Choose just one structure for applications that want just one –XLE displays most probable first –5% of parse time to disambiguate –30% gain in F-score

Talk Outline Sources of ambiguity Grammar engineering approaches –Shallow markup –(Dis)preference marks Stochastic disambiguation Efficiency in ambiguity management

Computational consequences of ambiguity Serious problem for computational systems –Broad coverage, hand written grammars frequently produce thousands of analyses, sometimes millions –Machine learned grammars easily produce hundreds of thousands of analyses if allowed to parse to completion Three approaches to ambiguity management: –Pruning: block unlikely analysis paths early –Procrastination: do not expand analysis paths that will lead to ambiguity explosion until something else requires them »Also known as underspecification –Packing: compact representation and computation of all possible analyses

The Problem with Pruning: premature disambiguation The conventional approach: Use heuristics to prune as soon as possible TokenizeMorphologySyntaxSemanticsDiscourse X X X Statistics X Strong constraints may reject the so-far-best (= only) option Fast computation, wrong result X

The problem with procrastination: passing the buck Chunk parsing as an example: –Collect noun groups, verb groups, PP groups –Leave it to later processing to figure out the correct way of putting these together –Not all combinations are grammatically acceptable Later processing must either –Call parser to check grammatical constraints –Have its own model of grammatical constraints –In the best case, solve a set of constraints the partial parser includes with its output

The Problem with Packing There may be too many analyses to pack efficiently A major problem for relatively unconstrained machine induced grammars –Grammars overgenerate massively –Statistics used to prune out unlikely sub-analyses Less of a problem for carefully hand-coded broad coverage grammars

Packing Explosion of ambiguity results from a small number of sub-analyses combining in different ways to produce a large number of total analyses (e.g. PP attachment) Compute and represent each sub-analysis just once Compute a factored representation of how these sub-analyses combine

Generalizing Free Choice Packing The sheep saw the fish. How many sheep? How many fish? The sheep-sg saw the fish-sg. The sheep-pl saw the fish-sg. The sheep-sg saw the fish-pl. The sheep-pl saw the fish-pl. Options multiplied out In principle, a verb might require agreement of Subject and Object: Have to check it out. The sheep saw the fish sg pl Options packed But English doesn’t do that: Any combination of choices is OK

Dependent choices Das Mädchen-nom sah die Katze-nom Das Mädchen-nom sah die Katze-acc Das Mädchen-acc sah die Katze-nom Das Mädchen-acc sah die Katze-acc bad The girl saw the cat The cat saw the girl bad Das Mädchen sah die Katze nom acc The girl saw the cat Again, packing avoids duplication … but it’s wrong It doesn’t encode all dependencies, choices are not free.

Solution: Label dependent choices Das Mädchen-nom sah die Katze-nom Das Mädchen-nom sah die Katze-acc Das Mädchen-acc sah die Katze-nom Das Mädchen-acc sah die Katze-acc bad The girl saw the cat The cat saw the girl bad Label each choice with distinct Boolean variables p, q, etc. Record acceptable combinations as a Boolean expression  Each analysis corresponds to a satisfying truth-value assignment (a line from  ’s truth table that assigns it “true”) Das Mädchen sah die Katze p:nom  p:acc q:nom  q:acc (p  q)  (  p  q)  = =

The Free Choice Gamble Worst case, where everything interacts: –As many choice variables as there are readings –Packing blows up, and becomes exponential Best case, no interactions –N completely independent choices represent 2 N readings Language interactions mostly limited & local –Tends towards the best case –Free choice packing pays off for linguistic analysis

Conclusions Ambiguity has to be dealt with Deep grammars use a variety of approaches –preprocessing –grammar engineering –stochastic disambiguation Why use deep grammars if they are so ambiguous?

Deep analysis matters… if you care about the answer Example: A delegation led by Vice President Philips, head of the chemical division, flew to Chicago a week after the incident. Question: Who flew to Chicago? Candidate answers: division closest noun headnext closest V.P. Philipsnext shallow but wrong delegation furthest away but Subject of flew deep and right

Applications of Language Engineering Functionality Domain Coverage Low Narrow Broad High Alta Vista AskJeeves Google Post-Search Sifting Autonomous Knowledge Filtering Natural Dialogue Knowledge Fusion Microsoft Paperclip Manually-tagged Keyword Search Document Base Management Restricted Dialogue Useful Summary Good Translation

What to do with them? Define yes-no / 1-0 features, f, that seem important Training determines weights on these features, λ, to reflect their actual importance Select parse x: count occurrences of features (0,1) and multiply by corresponding weights, λ.f(x) Convert weighted feature counts to probabilities e λ.f(x)  e λ.f(X) Un-normalized probability Normalizing factor

Issues in Stochastic Disambiguation What kind of probability model? What kind of training data? Efficiency of training, efficiency of disambiguation? Benefit vs. random choice of parse

Advantages of Free Choice Packing Avoids procrastination –Nogoods are constraints that parser sends to other component –Eliminating nogoods: other components don’t do parser’s work Independence between choices: Allows processing relying on independence assumptions –Counting number of readings »Apparently trivial but of crucial importance, since statistical modelling requires the ability to count –Hence, statistical processing A general mechanism extending beyond parsing

Simplifying Truth Tables Das Mädchen sah die Katze p:nom  p:acc q:nom  q:acc (p  q)  (  p  q)  = = p q  (q =  p) Das Mädchen sah die Katze p:nom  p:acc  p :nom p :acc (p   p)  = = p  Freely choose any line from the truth table