CKY & Earley Parsing. Ling 571 Deep Processing Techniques for NLP January 13, 2016

Similar documents
Review. Earley Algorithm Chapter Left Recursion. Left-Recursion. Rule Ordering. Rule Ordering

Parsing with CFGs L445 / L545 / B659. Dept. of Linguistics, Indiana University Spring Parsing with CFGs. Direction of processing

Parsing with CFGs. Direction of processing. Top-down. Bottom-up. Left-corner parsing. Chart parsing CYK. Earley 1 / 46.

Natural Language Processing. Lecture 13: More on CFG Parsing

Parsing with Context-Free Grammars

CMPT-825 Natural Language Processing. Why are parsing algorithms important?

An Efficient Context-Free Parsing Algorithm. Speakers: Morad Ankri Yaniv Elia

Statistical Machine Translation

LECTURER: BURCU CAN Spring

Introduction to Computational Linguistics

Context- Free Parsing with CKY. October 16, 2014

Context-Free Parsing: CKY & Earley Algorithms and Probabilistic Parsing

Parsing with Context-Free Grammars

Parsing. Based on presentations from Chris Manning s course on Statistical Parsing (Stanford)

Probabilistic Context-free Grammars

Handout 8: Computation & Hierarchical parsing II. Compute initial state set S 0 Compute initial state set S 0

Parsing. Probabilistic CFG (PCFG) Laura Kallmeyer. Winter 2017/18. Heinrich-Heine-Universität Düsseldorf 1 / 22

Natural Language Processing CS Lecture 06. Razvan C. Bunescu School of Electrical Engineering and Computer Science

Context-Free Parsing: CKY & Earley Algorithms and Probabilistic Parsing

Context-Free Parsing: CKY & Earley Algorithms and Probabilistic Parsing

Parsing. Left-Corner Parsing. Laura Kallmeyer. Winter 2017/18. Heinrich-Heine-Universität Düsseldorf 1 / 17

Grammar formalisms Tree Adjoining Grammar: Formal Properties, Parsing. Part I. Formal Properties of TAG. Outline: Formal Properties of TAG

In this chapter, we explore the parsing problem, which encompasses several questions, including:

CS 6120/CS4120: Natural Language Processing

Syntax-Based Decoding

Constituency Parsing

CS460/626 : Natural Language

Parsing. Unger s Parser. Laura Kallmeyer. Winter 2016/17. Heinrich-Heine-Universität Düsseldorf 1 / 21

Remembering subresults (Part I): Well-formed substring tables

Introduction to Natural Language Processing

A* Search. 1 Dijkstra Shortest Path

Chapter 14 (Partially) Unsupervised Parsing

Statistical Methods for NLP

Aspects of Tree-Based Statistical Machine Translation

Probabilistic Context-Free Grammars. Michael Collins, Columbia University

Parsing. Unger s Parser. Introduction (1) Unger s parser [Grune and Jacobs, 2008] is a CFG parser that is

CS626: NLP, Speech and the Web. Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture 14: Parsing Algorithms 30 th August, 2012

Decoding and Inference with Syntactic Translation Models

Syntactic Analysis. Top-Down Parsing

Computational Linguistics II: Parsing

Attendee information. Seven Lectures on Statistical Parsing. Phrase structure grammars = context-free grammars. Assessment.

Predictive parsing as a specific subclass of recursive descent parsing complexity comparisons with general parsing

Probabilistic Context Free Grammars. Many slides from Michael Collins and Chris Manning

Natural Language Processing

CISC4090: Theory of Computation

This kind of reordering is beyond the power of finite transducers, but a synchronous CFG can do this.

Probabilistic Context Free Grammars

Everything You Always Wanted to Know About Parsing

Advanced Natural Language Processing Syntactic Parsing

Follow sets. LL(1) Parsing Table

Multilevel Coarse-to-Fine PCFG Parsing

Processing/Speech, NLP and the Web

Introduction to Bottom-Up Parsing

Introduction to Bottom-Up Parsing

Natural Language Processing : Probabilistic Context Free Grammars. Updated 5/09

A Supertag-Context Model for Weakly-Supervised CCG Parser Learning

Introduction to Bottom-Up Parsing

Aspects of Tree-Based Statistical Machine Translation

Artificial Intelligence

Introduction to Bottom-Up Parsing

Probabilistic Context Free Grammars. Many slides from Michael Collins

Decision problem of substrings in Context Free Languages.

Mildly Context-Sensitive Grammar Formalisms: Thread Automata

A DOP Model for LFG. Rens Bod and Ronald Kaplan. Kathrin Spreyer Data-Oriented Parsing, 14 June 2005

CS 662 Sample Midterm

Sequence Labeling: HMMs & Structured Perceptron

1. For the following sub-problems, consider the following context-free grammar: S A$ (1) A xbc (2) A CB (3) B yb (4) C x (6)

Natural Language Processing 1. lecture 7: constituent parsing. Ivan Titov. Institute for Logic, Language and Computation

Top-Down Parsing and Intro to Bottom-Up Parsing

Computing if a token can follow

Today. Finish word sense disambigua1on. Midterm Review

Syntactical analysis. Syntactical analysis. Syntactical analysis. Syntactical analysis

CS153: Compilers Lecture 5: LL Parsing

An Efficient Probabilistic Context-Free Parsing Algorithm that Computes Prefix Probabilities

Computer Science 160 Translation of Programming Languages

Harvard CS 121 and CSCI E-207 Lecture 10: CFLs: PDAs, Closure Properties, and Non-CFLs

Notes for Comp 497 (Comp 454) Week 10 4/5/05

{Probabilistic Stochastic} Context-Free Grammars (PCFGs)

Harvard CS 121 and CSCI E-207 Lecture 9: Regular Languages Wrap-Up, Context-Free Grammars

Probabilistic Context-Free Grammar

10. The GNFA method is used to show that

Random Generation of Nondeterministic Tree Automata

October 6, Equivalence of Pushdown Automata with Context-Free Gramm

Soft Inference and Posterior Marginals. September 19, 2013

CMSC 723: Computational Linguistics I Session #5 Hidden Markov Models. The ischool University of Maryland. Wednesday, September 30, 2009

Syntax-based Statistical Machine Translation

Algorithms for Syntax-Aware Statistical Machine Translation

Parsing -3. A View During TD Parsing

cmp-lg/ Nov 1994

Theory of Computation (IV) Yijia Chen Fudan University

Logic. proof and truth syntacs and semantics. Peter Antal

Pushdown Automata: Introduction (2)

CS : Speech, NLP and the Web/Topics in AI

h>p://lara.epfl.ch Compiler Construc/on 2011 CYK Algorithm and Chomsky Normal Form

Lecture 13: Structured Prediction

Bottom-Up Parsing. Ÿ rm E + F *idÿ rm E +id*idÿ rm T +id*id. Ÿ rm F +id*id Ÿ rm id + id * id

Harvard CS 121 and CSCI E-207 Lecture 12: General Context-Free Recognition

Lecture 7: Introduction to syntax-based MT

Log-Linear Models with Structured Outputs

PCFGs 2 L645 / B659. Dept. of Linguistics, Indiana University Fall PCFGs 2. Questions. Calculating P(w 1m ) Inside Probabilities

Transcription:

CKY & Earley Parsing Ling 571 Deep Processing Techniques for NLP January 13, 2016

No Class Monday: Martin Luther King Jr. Day

CKY Parsing: Finish the parse Recognizer à Parser Roadmap Earley parsing Motivation: CKY Strengths and Limitations Earley model: Efficient parsing with arbitrary grammars Procedures: Predictor, Scanner, Completer

0 Book 1 the 2 flight 3 through 4 Houston 5 Book the Flight Through Houston NN, VB, Nominal, VP, S [0,1] [0,2] Det [1,2] S, VP, X2 [0,3] NP [1,3] NN, Nominal [2,3]

0 Book 1 the 2 flight 3 through 4 Houston 5 Book the Flight Through Houston NN, VB, Nominal, VP, S [0,1] [0,2] Det [1,2] S, VP, X2 [0,3] [0,4] NP [1,3] [1,4] NN, Nominal [2,3] [2,4] Prep [3,4]

0 Book 1 the 2 flight 3 through 4 Houston 5 Book the Flight Through Houston NN, VB, Nominal, VP, S [0,1] [0,2] Det [1,2] S, VP, X2 [0,3] [0,4] NP [1,3] [1,4] NN, Nominal [2,3] [2,4] Prep [3,4] S, VP, X2 [0,5] NP [1,5] Nominal [2,5] PP [3,5] NNP, NP [4,5]

From Recognition to Parsing Limitations of current recognition algorithm: Only stores non-terminals in cell Not rules or cells corresponding to RHS Stores SETS of non-terminals Can t store multiple rules with same LHS Parsing solution: All repeated versions of non-terminals Pair each non-terminal with pointers to cells Backpointers Last step: construct trees from back-pointers in [0,n]

Filling column 5

Running time: CKY Discussion O(n 3 ) where n is the length of the input string Inner loop grows as square of # of non-terminals Expressiveness: As implemented, requires CNF Weakly equivalent to original grammar Doesn t capture full original structure Back-conversion? Can do binarization, terminal conversion Unit non-terminals require change in CKY

Parsing Efficiently With arbitrary grammars Earley algorithm Top-down search Dynamic programming Tabulated partial solutions Some bottom-up constraints

Earley Parsing Avoid repeated work/recursion problem Dynamic programming Store partial parses in chart Compactly encodes ambiguity O(N 3 ) Chart entries: Subtree for a single grammar rule Progress in completing subtree Position of subtree wrt input

Earley Algorithm First, left-to-right pass fills out a chart with N+1 states Think of chart entries as sitting between words in the input string, keeping track of states of the parse at these positions For each word position, chart contains set of states representing all partial parse trees generated to date. E.g. chart[0] contains all partial parse trees generated at the beginning of the sentence

Chart Entries Represent three types of constituents: predicted constituents in-progress constituents completed constituents

Parse Progress Represented by Dotted Rules Position of indicates type of constituent 0 Book 1 that 2 flight 3 S VP, [0,0] (predicted) NP Det Nom, [1,2] (in progress) VP V NP, [0,3] (completed) [x,y] tells us what portion of the input is spanned so far by this rule Each State s i : <dotted rule>, [<back pointer>,<current position>]

0 Book 1 that 2 flight 3 S VP, [0,0] First 0 means S constituent begins at the start of input Second 0 means the dot here too So, this is a top-down prediction NP Det Nom, [1,2] the NP begins at position 1 the dot is at position 2 so, Det has been successfully parsed Nom predicted next

0 Book 1 that 2 flight 3 (continued) VP V NP, [0,3] Successful VP parse of entire input

Successful Parse Final answer found by looking at last entry in chart If entry resembles S α [0,N] then input parsed successfully Chart will also contain record of all possible parses of input string, given the grammar

Parsing Procedure for the Earley Algorithm Move through each set of states in order, applying one of three operators to each state: predictor: add predictions to the chart scanner: read input and add corresponding state to chart completer: move dot to right when new constituent found Results (new states) added to current or next set of states in chart No backtracking and no states removed: keep complete history of parse

States and State Sets Dotted Rule s i represented as <dotted rule>, [<back pointer>, <current position>] State Set S j to be a collection of states s i with the same <current position>.

Earley Algorithm from Book

Earley Algorithm from Book

3 Main Sub-Routines of Earley Algorithm Predictor: Adds predictions into the chart. Completer: Moves the dot to the right when new constituents are found. Scanner: Reads the input words and enters states representing those words into the chart.

Predictor Intuition: create new state for top-down prediction of new phrase. Applied when non part-of-speech nonterminals are to the right of a dot: S VP [0,0] Adds new states to current chart One new state for each expansion of the nonterminal in the grammar VP V [0,0] VP V NP [0,0] Formally: S j : A α B β, [i,j] S j : B γ, [j,j]

Chart[0] Jurafsky and Martin Note that given a grammar, these entries are the same for all inputs; they can be pre-loaded. Speech and Language Processing - 1/13/16