Chapter 10. Parsing with CFGs From: Chapter 10 of An Introduction to Natural Language Processing, Computational Linguistics, and Speech Recognition, by.

Slides:



Advertisements
Similar presentations
Basic Parsing with Context-Free Grammars CS 4705 Julia Hirschberg 1 Some slides adapted from Kathy McKeown and Dan Jurafsky.
Advertisements

Natural Language Processing - Parsing 1 - Language, Syntax, Parsing Problems in Parsing Ambiguity, Attachment / Binding Bottom vs. Top Down Parsing.
May 2006CLINT-LN Parsing1 Computational Linguistics Introduction Approaches to Parsing.
PARSING WITH CONTEXT-FREE GRAMMARS
Parsing with Context Free Grammars Reading: Chap 13, Jurafsky & Martin
CKY Parsing Ling 571 Deep Processing Techniques for NLP January 12, 2011.
Artificial Intelligence 2004 Natural Language Processing - Syntax and Parsing - Language, Syntax, Parsing Problems in Parsing Ambiguity, Attachment.
1 Earley Algorithm Chapter 13.4 October 2009 Lecture #9.
 Christel Kemke /08 COMP 4060 Natural Language Processing PARSING.
CS Basic Parsing with Context-Free Grammars.
Parsing context-free grammars Context-free grammars specify structure, not process. There are many different ways to parse input in accordance with a given.
Albert Gatt LIN3022 Natural Language Processing Lecture 8.
Parsing with CFG Ling 571 Fei Xia Week 2: 10/4-10/6/05.
CS 4705 Lecture 7 Parsing with Context-Free Grammars.
Syntactic Parsing with CFGs CMSC 723: Computational Linguistics I ― Session #7 Jimmy Lin The iSchool University of Maryland Wednesday, October 14, 2009.
CS 4705 Basic Parsing with Context-Free Grammars.
Artificial Intelligence 2004 Natural Language Processing - Syntax and Parsing - Language Syntax Parsing.
Parsing SLP Chapter 13. 7/2/2015 Speech and Language Processing - Jurafsky and Martin 2 Outline  Parsing with CFGs  Bottom-up, top-down  CKY parsing.
Syntax Construction of phrases and sentences from morphemes and words. Usually the word syntax refers to the way words are arranged together. Syntactic.
Basic Parsing with Context- Free Grammars 1 Some slides adapted from Julia Hirschberg and Dan Jurafsky.
Context-Free Grammar CSCI-GA.2590 – Lecture 3 Ralph Grishman NYU.
1 Basic Parsing with Context Free Grammars Chapter 13 September/October 2012 Lecture 6.
11 CS 388: Natural Language Processing: Syntactic Parsing Raymond J. Mooney University of Texas at Austin.
Context Free Grammars Reading: Chap 12-13, Jurafsky & Martin This slide set was adapted from J. Martin, U. Colorado Instructor: Paul Tarau, based on Rada.
1 CPE 480 Natural Language Processing Lecture 5: Parser Asst. Prof. Nuttanart Facundes, Ph.D.
BİL711 Natural Language Processing
CS 4705 Parsing More Efficiently and Accurately. Review Top-Down vs. Bottom-Up Parsers Left-corner table provides more efficient look- ahead Left recursion.
1 Statistical Parsing Chapter 14 October 2012 Lecture #9.
1 CKY and Earley Algorithms Chapter 13 October 2012 Lecture #8.
GRAMMARS David Kauchak CS159 – Fall 2014 some slides adapted from Ray Mooney.
LINGUISTICA GENERALE E COMPUTAZIONALE ANALISI SINTATTICA (PARSING)
Finite State Parsing & Information Extraction CMSC Intro to NLP January 10, 2006.
10. Parsing with Context-free Grammars -Speech and Language Processing- 발표자 : 정영임 발표일 :
Context-Free Parsing Read J & M Chapter 10.. Basic Parsing Facts Regular LanguagesContext-Free Languages Required Automaton FSMPDA Algorithm to get rid.
Fall 2004 Lecture Notes #4 EECS 595 / LING 541 / SI 661 Natural Language Processing.
October 2005csa3180: Parsing Algorithms 11 CSA350: NLP Algorithms Sentence Parsing I The Parsing Problem Parsing as Search Top Down/Bottom Up Parsing Strategies.
Parsing with Context Free Grammars CSC 9010 Natural Language Processing Paula Matuszek and Mary-Angela Papalaskari This slide set was adapted from: Jim.
Parsing I: Earley Parser CMSC Natural Language Processing May 1, 2003.
PARSING David Kauchak CS159 – Spring 2011 some slides adapted from Ray Mooney.
Context Free Grammars Reading: Chap 9, Jurafsky & Martin This slide set was adapted from J. Martin, U. Colorado Instructor: Rada Mihalcea.
11 Chapter 14 Part 1 Statistical Parsing Based on slides by Ray Mooney.
6/2/2016CPSC503 Winter CPSC 503 Computational Linguistics Lecture 9 Giuseppe Carenini.
October 2008CSA3180: Sentence Parsing1 CSA3180: NLP Algorithms Sentence Parsing Algorithms 2 Problems with DFTD Parser.
Parsing with Context-Free Grammars References: 1.Natural Language Understanding, chapter 3 (3.1~3.4, 3.6) 2.Speech and Language Processing, chapters 9,
Sentence Parsing Parsing 3 Dynamic Programming. Jan 2009 Speech and Language Processing - Jurafsky and Martin 2 Acknowledgement  Lecture based on  Jurafsky.
Natural Language - General
PARSING 2 David Kauchak CS159 – Spring 2011 some slides adapted from Ray Mooney.
NLP. Introduction to NLP Motivation –A lot of the work is repeated –Caching intermediate results improves the complexity Dynamic programming –Building.
CS 4705 Lecture 10 The Earley Algorithm. Review Top-Down vs. Bottom-Up Parsers –Both generate too many useless trees –Combine the two to avoid over-generation:
csa3050: Parsing Algorithms 11 CSA350: NLP Algorithms Parsing Algorithms 1 Top Down Bottom-Up Left Corner.
Computerlinguistik II / Sprachtechnologie Vorlesung im SS 2010 (M-GSW-10) Prof. Dr. Udo Hahn Lehrstuhl für Computerlinguistik Institut für Germanistische.
CS 4705 Lecture 7 Parsing with Context-Free Grammars.
Natural Language Processing Lecture 15—10/15/2015 Jim Martin.
GRAMMARS David Kauchak CS457 – Spring 2011 some slides adapted from Ray Mooney.
Instructor: Nick Cercone CSEB - 1 Parsing and Context Free Grammars Parsers, Top Down, Bottom Up, Left Corner, Earley.
October 2005CSA3180: Parsing Algorithms 21 CSA3050: NLP Algorithms Parsing Algorithms 2 Problems with DFTD Parser Earley Parsing Algorithm.
November 2009HLT: Sentence Parsing1 HLT Sentence Parsing Algorithms 2 Problems with Depth First Top Down Parsing.
PARSING David Kauchak CS159 – Fall Admin Assignment 3 Quiz #1  High: 36  Average: 33 (92%)  Median: 33.5 (93%)
Speech and Language Processing SLP Chapter 13 Parsing.
Parsing with Context Free Grammars. Slide 1 Outline Why should you care? Parsing Top-Down Parsing Bottom-Up Parsing Bottom-Up Space (an example) Top -
Basic Parsing with Context Free Grammars Chapter 13
CKY Parser 0Book 1 the 2 flight 3 through 4 Houston5 6/19/2018
CPSC 503 Computational Linguistics
CKY Parser 0Book 1 the 2 flight 3 through 4 Houston5 11/16/2018
CS 388: Natural Language Processing: Syntactic Parsing
Lecture 14: Grammar and Parsing (II) November 11, 2004 Dan Jurafsky
Natural Language - General
Parsing and More Parsing
CPSC 503 Computational Linguistics
CSA2050 Introduction to Computational Linguistics
Presentation transcript:

Chapter 10. Parsing with CFGs From: Chapter 10 of An Introduction to Natural Language Processing, Computational Linguistics, and Speech Recognition, by Daniel Jurafsky and James H. Martin

Parsing with CFG2 Background Syntactic parsing –The task of recognizing a sentence and assigning a syntactic structure to it Since CFGs are a declarative formalism, they do not specify how the parse tree for a given sentence should be computed. Parse trees are useful in applications such as –Grammar checking –Semantic analysis –Machine translation –Question answering –Information extraction

Parsing with CFG Parsing as Search The parser can be viewed as searching through the space of all possible parse trees to find the correct parse tree for the sentence. How can we use the grammar to produce the parse tree?

Parsing with CFG Parsing as Search Top-down parsing

Parsing with CFG Parsing as Search Bottom-up parsing

Parsing with CFG Parsing as Search Comparisons –The top-down strategy never wastes time exploring trees that cannot result in an S. –The bottom-up strategy, by contrast, trees that have no hope to leading to an S, or fitting in with any of their neighbors, are generated with wild abandon. The left branch of Fig is completely wasted effort. –Spend considerable effort on S trees that are not consistent with the input. The first four of the six trees in Fig cannot match the word book.

Parsing with CFG A Basic Top-Down Parser Use depth-first strategy

Parsing with CFG A Basic Top-Down Parser

Parsing with CFG A Basic Top-Down Parser A top-down, depth- first, left-to-right derivation

Parsing with CFG A Basic Top-Down Parser

Parsing with CFG A Basic Top-Down Parser Adding bottom-up filtering Left-corner notion –For nonterminals A and B, B is a left-corner of A if the following relation holds: A  B  Using the left-corner notion, it is easy to see that only the S  Aux NP VP rule is a viable candidate Since the word Does can not server as the left-corner of other two S-rules. * S  NP VP A  Aux NP VP S  VP

Parsing with CFG A Basic Top-Down Parser CategoryLeft Corners SDet, Proper-Noun, Aux, Verb NPDet, Proper-Noun NominalNoun VPVerb

Parsing with CFG Problems with the Basic Top-Down Parser Problems with the top-down parser –Left-recursion –Ambiguity –Inefficiency reparsing of subtrees Then, introducing the Earley algorithm

Parsing with CFG Problems with the Basic Top-Down Parser Left-Recursion Exploring infinite search space, when left-recursive grammars are used A grammar is left-recursive if it contains at least one NT A, such that A   A , for some  and  and   ε. * * NP  Det Nominal Det  NP ‘ s NP  NP PP VP  VP PP S  S and S Left-recursive rules

Parsing with CFG Problems with the Basic Top-Down Parser Left-Recursion Two reasonable methods for dealing with left-recursion in a backtracking top-down parser: –Rewriting the grammar –Explicitly managing the depth of the search during parsing Rewrite each rule of left-recursion A  A  |   A   A ’ A ’   A | ε

Parsing with CFG Problems with the Basic Top-Down Parser Ambiguity Common structural ambiguity –Attachment ambiguity –Coordination ambiguity –NP bracketing ambiguity

Parsing with CFG Problems with the Basic Top-Down Parser Ambiguity Example of PP attachment

Parsing with CFG Problems with the Basic Top-Down Parser Ambiguity The gerundive-VP flying to Paris can be – part of a gerundive sentence, or –an adjunct modifying the VP We saw the Eiffel Tower flying to Paris.

Parsing with CFG Problems with the Basic Top-Down Parser Ambiguity The sentence “ Can you book TWA flights ” is ambiguous –“ Can you book flights on behalf of TWA ” –“ Can you book flights run by TWA ”

Parsing with CFG Problems with the Basic Top-Down Parser Ambiguity Coordination ambiguity –Different set of phrases that can be conjoined by a conjunction like and. –For example old men and women can be [old [men and women]] or [old men] and [women] Parsing sentence thus requires disambiguation: –Choosing the correct parse from a multitude of possible parser –Requiring both statistical (Ch 12) and semantic knowledge (Ch 17)

Parsing with CFG Problems with the Basic Top-Down Parser Ambiguity Parsers which do not incorporate disambiguators may simply return all the possible parse trees for a given input. We do not want all possible parses from the robust, highly ambiguous, wide-coverage grammars used in practical applications. Reason: –Potentially exponential number of parses that are possible for certain inputs –Given the ATIS example: Show me the meal on Flight UA 386 from San Francisco to Denver. –The three PP ’ s at the end of this sentence yield a total of 14 parse trees for this sentence.

Parsing with CFG Problems with the Basic Top-Down Parser Repeated Parsing Subtrees The parser often builds valid parse trees for portion of the input, then discards them during backtracking, only to find that it has to rebuild them again. a flight From Indianapolis To Houston On TWA A flight from Indianapolis A flight from Indianapolis to Houston A flight from Indianapolis to Houston on TWA

Parsing with CFG The Earley Algorithm Solving three kinds of problems afflicting standard bottom-up or top- down parsers Dynamic programming providing a framework for solving this problem –Systematically fill in tables of solutions to sub-problems. –When complete, the tables contain solution to all sub-problems needed to solve the problem as a whole. –Reducing an exponential-time problem to a polynomial-time one by eliminating the repetitive solution of sub-problems inherently iin backtracking approaches –O(N 3 ), where N is the number of words in the input

Parsing with CFG The Earley Algorithm (10.7) Book that flight S   VP, [0,0] NP  Det  Nominal, [1,2] VP  V NP , [0,3]

Parsing with CFG The Earley Algorithm

Parsing with CFG The Earley Algorithm

Parsing with CFG The Earley Algorithm Sequence of state created in Chart while parsing Book that flight including Structural information

Parsing with CFG Finite-State Parsing Methods Partial parsing or shallow parsing –Some language processing tasks do not require complete parses. –E.g., information extraction algorithms generally do not extract all the possible information in a text; they simply extract enough to fill out some sort of template of required data. Many partial parsing systems use cascade of finite-state automata instead of CFGs. –Use FSA to recognize basic phrases, such as noun groups, verb groups, locations, etc. –FASTUS of SRI Company Name: Verb Group: Noun Group: Verb Group Noun Group: Preposition Location: Preposition: Noun Group: Conjunction: Noun Group: Verb Group Noun Group: Verb Group: Preposition Location: Bridgestone Sports Co. said Friday it had set up a joint venture in Taiwan with a local concern and a Japanese trading hounse to produce golf clubs to be shipped to Japan

Parsing with CFG Finite-State Parsing Methods Detection of noun group NG  Pronoun | Time-NP | Date-NP she, him, them, yesterday NG  (DETP) (Adjs) HdNns | DETP Ving HdNns the quick and dirty solution, the frustrating mathematics problem, the rising index DETP  DETP-CP | DET-INCP DETP-CP  … DETP-INCP  … Adjs  AdjP … AdjP  … HdNns  HdNn … HdNn  PropN |PreNs … PreNs  PreN … PreN ..

Parsing with CFG Finite-State Parsing Methods