Dependency Parsing Parsing Algorithms Peng.Huang

Slides:



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

Constraint Satisfaction Problems
CSC411Artificial Intelligence 1 Chapter 3 Structures and Strategies For Space State Search Contents Graph Theory Strategies for Space State Search Using.
CSA2050: DCG I1 CSA2050 Introduction to Computational Linguistics Lecture 8 Definite Clause Grammars.
Grammars, constituency and order A grammar describes the legal strings of a language in terms of constituency and order. For example, a grammar for a fragment.
R Yun-Nung Chen 資工碩一 陳縕儂 1 /39.  Non-projective Dependency Parsing using Spanning Tree Algorithms (HLT/EMNLP 2005)  Ryan McDonald, Fernando.
Grammars, Languages and Parse Trees. Language Let V be an alphabet or vocabulary V* is set of all strings over V A language L is a subset of V*, i.e.,
Dependency Parsing Joakim Nivre. Dependency Grammar Old tradition in descriptive grammar Modern theroretical developments: –Structural syntax (Tesnière)
Dependency Parsing Some slides are based on:
GRAMMAR & PARSING (Syntactic Analysis) NLP- WEEK 4.
10. Lexicalized and Probabilistic Parsing -Speech and Language Processing- 발표자 : 정영임 발표일 :
March 1, 2009 Dr. Muhammed Al-Mulhem 1 ICS 482 Natural Language Processing Probabilistic Context Free Grammars (Chapter 14) Muhammed Al-Mulhem March 1,
LTAG Semantics on the Derivation Tree Presented by Maria I. Tchalakova.
Amirkabir University of Technology Computer Engineering Faculty AILAB Efficient Parsing Ahmad Abdollahzadeh Barfouroush Aban 1381 Natural Language Processing.
Parsing with PCFG Ling 571 Fei Xia Week 3: 10/11-10/13/05.
Context-Free Grammar Parsing by Message Passing Paper by Dekang Lin and Randy Goebel Presented by Matt Watkins.
Amirkabir University of Technology Computer Engineering Faculty AILAB Parsing Ahmad Abdollahzadeh Barfouroush Aban 1381 Natural Language Processing Course,
Validating Streaming XML Documents Luc Segoufin & Victor Vianu Presented by Harel Paz.
Features and Unification
1/17 Probabilistic Parsing … and some other approaches.
Chapter 3: Formal Translation Models
Fundamentals of Python: From First Programs Through Data Structures
Probabilistic Parsing Ling 571 Fei Xia Week 5: 10/25-10/27/05.
Lexical and syntax analysis
Important Problem Types and Fundamental Data Structures
SI485i : NLP Set 9 Advanced PCFGs Some slides from Chris Manning.
Binary Trees Chapter 6.
3.0 State Space Representation of Problems 3.1 Graphs 3.2 Formulating Search Problems 3.3 The 8-Puzzle as an example 3.4 State Space Representation using.
1 CS546: Machine Learning and Natural Language Preparation to the Term Project: - Dependency Parsing - Dependency Representation for Semantic Role Labeling.
Probabilistic Parsing Reading: Chap 14, Jurafsky & Martin This slide set was adapted from J. Martin, U. Colorado Instructor: Paul Tarau, based on Rada.
1 Data-Driven Dependency Parsing. 2 Background: Natural Language Parsing Syntactic analysis String to (tree) structure He likes fish S NP VP NP VNPrn.
1 Natural Language Processing Lecture 11 Efficient Parsing Reading: James Allen NLU (Chapter 6)
Introduction Of Tree. Introduction A tree is a non-linear data structure in which items are arranged in sequence. It is used to represent hierarchical.
Chapter 6 Binary Trees. 6.1 Trees, Binary Trees, and Binary Search Trees Linked lists usually are more flexible than arrays, but it is difficult to use.
Dependency Parsing Prashanth Mannem
Parsing I: Earley Parser CMSC Natural Language Processing May 1, 2003.
Unit-1 Introduction Prepared by: Prof. Harish I Rathod
A Cascaded Finite-State Parser for German Michael Schiehlen Institut für Maschinelle Sprachverarbeitung Universität Stuttgart
Page 1 Probabilistic Parsing and Treebanks L545 Spring 2000.
Dependency Parser for Swedish Project for EDA171 by Jonas Pålsson Marcus Stamborg.
Agenda Review: –Planar Graphs Lecture Content:  Concepts of Trees  Spanning Trees  Binary Trees Exercise.
CSA2050 Introduction to Computational Linguistics Parsing I.
Basic Parsing Algorithms: Earley Parser and Left Corner Parsing
PARSING 2 David Kauchak CS159 – Spring 2011 some slides adapted from Ray Mooney.
Quick Speech Synthesis CMSC Natural Language Processing April 29, 2003.
© 2005 Hans Uszkoreit FLST WS 05/06 FLST Grammars and Parsing Hans Uszkoreit.
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:
NLP. Introduction to NLP The probabilities don’t depend on the specific words –E.g., give someone something (2 arguments) vs. see something (1 argument)
NLP. Introduction to NLP Time flies like an arrow –Many parses –Some (clearly) more likely than others –Need for a probabilistic ranking method.
PARSING David Kauchak CS159 – Fall Admin Assignment 3 Quiz #1  High: 36  Average: 33 (92%)  Median: 33.5 (93%)
Computational lexicology, morphology and syntax Diana Trandabă
Chapter 11. Chapter Summary  Introduction to trees (11.1)  Application of trees (11.2)  Tree traversal (11.3)  Spanning trees (11.4)
Dependency Parsing Niranjan Balasubramanian March 24 th 2016 Credits: Many slides from: Michael Collins, Mausam, Chris Manning, COLNG 2014 Dependency Parsing.
Genetic Programming. What is Genetic Programming? GP for Symbolic Regression Other Representations for GP Example of GP for Knowledge Discovery Outline.
Natural Language Processing : Probabilistic Context Free Grammars Updated 8/07.
Parsing Natural Scenes and Natural Language with Recursive Neural Networks INTERNATIONAL CONFERENCE ON MACHINE LEARNING (ICML 2011) RICHARD SOCHER CLIFF.
10/31/00 1 Introduction to Cognitive Science Linguistics Component Topic: Formal Grammars: Generating and Parsing Lecturer: Dr Bodomo.
Roadmap Probabilistic CFGs –Handling ambiguity – more likely analyses –Adding probabilities Grammar Parsing: probabilistic CYK Learning probabilities:
Natural Language Processing Vasile Rus
Computational lexicology, morphology and syntax
CSC 594 Topics in AI – Natural Language Processing
CS 404 Introduction to Compiler Design
CHAPTER 4 Trees.
Chapter 6 Intermediate-Code Generation
Parsing and More Parsing
CSA2050 Introduction to Computational Linguistics
Parsing I: CFGs & the Earley Parser
Compilers Principles, Techniques, & Tools Taught by Jing Zhang
Important Problem Types and Fundamental Data Structures
David Kauchak CS159 – Spring 2019
Presentation transcript:

Dependency Parsing Parsing Algorithms Peng.Huang

Outline  Introduction  Phrase Structure Grammar  Dependency Grammar  Comparison and Conve rsion  Dependency Parsing  Formal definition  Parsing Algorithms  Introduction  Dynamic programming  Constraint satisfaction  Deterministic search 2

Introduction  Syntactic Parsing  finding the correct syntactic structure of that sentence in a given formalism/grammar  Two Formalism  Dependency Parsing (DG)  Phrase Structure Grammar (PSG) 3

Phrase Structure Grammar (PSG)  Breaks sentence into constituents (phrases)  Which are then broken into smaller constituents  Describes phrase structure, clause structure  E.g.. NP, PP, VP etc..  Structures often recursive  The clever tall blue-eyed old … man 4

Tree Structure 5

Dependency Grammar  Syntactic structure consists of lexical items, linked by binary asymmetric relations called dependencies  Interested in grammatical relations between individual words (governing & dependent words)  Does not propose a recursive structure  Rather a network of relations  These relations can also have labels 6

Comparison Dependency structures explicitly represent –Head-dependent relations (directed arcs) –Functional categories (arc labels) –Possibly some structural categories (parts-of-speech) Phrase structure explicitly represent –Phrases (non-terminal nodes) –Structural categories (non-terminal labels) –Possibly some functional categories (grammatical functions) 7

Conversion … PSG to DG  Head of a phrase governs/dominates all the siblings  Heads are calculated using heuristics  Dependency relations are established between the head of each phrase as the parent and its siblings as children  The tree thus formed is the unlabeled dependency tree 8

PSG to DG 9

Conversion … DG to PSG  Each head together with its dependents (and their dependents) forms a constituent of the sentence  Difficult to assign the structural categories (NP, VP, S, PP etc…) to these derived constituents  Every projective dependency grammar has a strongly equivalent context-free grammar, but not vice versa [Gaifman 1965] 10

Outline  Introduction  Phrase Structure Grammar  Dependency Grammar  Comparison and Conve rsion  Dependency Parsing  Formal definition  Parsing Algorithms  Introduction  Dynamic programming  Constraint satisfaction  Deterministic search 11

Dependency Tree  Formal definition –An input word sequence w 1 …w n –Dependency graph D = (W,E) where  W is the set of nodes i.e. word tokens in the input seq  E is the set of unlabeled tree edges (w i, w j ) (w i, w j є W)  (w i, w j ) indicates an edge from w i (parent) to w j (child)  Formal definition Task of mapping an input string to a dependency graph satisfying certain conditions is called dependency parsing 12

Well-formedness  A dependency graph is well-formed iff  Single head: Each word has only one head  Acyclic: The graph should be acyclic  Connected: The graph should be a single tree with all the words in the sentence Projective: If word A depends on word B, then all words between A and B are also subordinate to B (i.e. dominated by B) 13

14 Non-projective dependency tree Ram saw a dog yesterday which was a Yorkshire Terrier * Crossing lines English has very few non-projective cases.

Outline  Introduction  Phrase Structure Grammar  Dependency Grammar  Comparison and Conve rsion  Dependency Parsing  Formal definition  Parsing Algorithms  Introduction  Dynamic programming  Constraint satisfaction  Deterministic search 15

Dependency Parsing (P. Mannem)16 Dependency Parsing Dependency based parsers can be broadly categorized into –Grammar driven approaches Parsing done using grammars. –Data driven approaches Parsing by training on annotated/un-annotated data. May 28, 2008

Well-formedness  A dependency graph is well-formed iff  Single head: Each word has only one head  Acyclic: The graph should be acyclic  Connected: The graph should be a single tree with all the words in the sentence Projective: If word A depends on word B, then all words between A and B are also subordinate to B (i.e. dominated by B) 17

18 Parsing Methods Three main traditions –Dynamic programming CYK, Eisner, McDonald –Constraint satisfaction Maruyama, Foth et al., Duchier –Deterministic search Covington, Yamada and Matsumuto, Nivre

Dynamic Programming  Basic Idea: Treat dependencies as constituents  Use, e.g., CYK parser (with minor modifications) 19

Eisner 1996  Two novel aspects:  Modified parsing algorithm  Probabilistic dependency parsing  Time requirement: O(n 3 )  Modification: Instead of storing subtrees, store spans  Span: Substring such that no interior word links to any word outside the span  Idea: In a span, only the boundary words are active, i.e. still need a head or a child 20

21 Re d figure s onon th e scree n indicat ed fallin g stocks_ROO T_ Example

22 Red figuresonthescreenindicatedfallingstocks_ROOT_ Example indicatedfallingstocks Red figures Spans:

23 Red figuresonthescreenindicatedfallingstocks_ROOT_ Assembly of correct parse Red figures Start by combining adjacent words to minimal spans figureson the

24 Red figuresonthescreenindicatedfallingstocks_ROOT _ Assembly of correct parse Combine spans which overlap in one word; this word must be governed by a word in the left or right span. onthe screen +→ onthescreen

25 Red figuresonthescreenindicatedfallingstocks_ROOT _ Assembly of correct parse Combine spans which overlap in one word; this word must be governed by a word in the left or right span. figure s on +→ thescreenfiguresonthescreen

26 Red figuresonthescreenindicatedfallingstocks_ROOT _ Assembly of correct parse Combine spans which overlap in one word; this word must be governed by a word in the left or right span. Invalid span Red figuresonthescreen

McDonald’s Maximum Spanning Trees  Score of a dependency tree = sum of scores of dependencies  Scores are independent of other dependencies  If scores are available, parsing can be formulated as maximum spanning tree problem  Uses online learning for determining weight vector w 27

McDonald’s Algorithm Score entire dependency tree Online Learning 28

29 Parsing Methods Three main traditions –Dynamic programming CYK, Eisner, McDonald –Constraint satisfaction Maruyama, Foth et al., Duchier –Deterministic search Covington, Yamada and Matsumuto, Nivre

Dependency Parsing (P. Mannem)30 Constraint Satisfaction Uses Constraint Dependency Grammar Grammar consists of a set of boolean constraints, i.e. logical formulas that describe well-formed trees A constraint is a logical formula with variables that range over a set of predefined values Parsing is defined as a constraint satisfaction problem Constraint satisfaction removes values that contradict constraints May 28, 2008

31 Parsing Methods Three main traditions –Dynamic programming CYK, Eisner, McDonald –Constraint satisfaction Maruyama, Foth et al., Duchier –Deterministic search Covington, Yamada and Matsumuto, Nivre

Deterministic Parsing  Basic idea –Derive a single syntactic representation (dependency graph) through a deterministic sequence of elementary parsing actions – Sometimes combined with backtracking or repair 32

Shift-Reduce Type Algorithms Data structures: –Stack [...,w i ]S of partially processed tokens –Queue [w j,...]Q of remaining input tokens Parsing actions built from atomic actions: –Adding arcs (w i → w j, w i ← w j ) –Stack and queue operations Left-to-right parsing 33

34 Yamada’s Algorithm  Three parsing actions:  Shift [...]S [w i,...]Q  [..., w i ]S [...]Q  Left[..., w i, w j ]S [...]Q  [..., w i ]S [...]Q w i → w j  Right[..., w i, w j ]S [...]Q  [..., w j ]S [...]Q w i ← w j  Multiple passes over the input give time complexity O(n 2 )

35 Yamada and Matsumoto Parsing in several rounds: deterministic bottom-up O(n 2 ) Looks at pairs of words 3 actions: shift, left, right Shift: shifts focus to next word pair

36 Yamada and Matsumoto Right: decides that the right word depends on the left word  Left: decides that the left word depends on the right one

37 Nivre’s Algorithm Four parsing actions: Shift[...]S [w i,...]Q [..., w i ]S [...]Q Reduce[..., w i ]S [...]Q Эw k : w k → w i [...]S [...]Q Left-Arc[..., w i ]S [w j,...]Q ¬Эw k : w k → w i [...]S [w j,...]Q w i ← w j Right-Arc [...,w i ]S [w j,...]Q ¬Эw k : w k → w j [..., w i, w j ]S [...]Q w i → w j

Dependency Parsing (P. Mannem)38 Nivre’s Algorithm Characteristics: –Arc-eager processing of right-dependents –Single pass over the input gives time worst case complexity O(2n) May 28, 2008

39 Red figuresonthescreenindicatedfallingstocks_ROOT_ Example SQ

40 Red figuresonthescreenindicatedfallingstocks_ROOT _ Example SQ Shift

41 Red figuresonthescreenindicatedfallingstocks_ROOT _ Example SQ Left-arc

42 Red figuresonthescreenindicatedfallingstocks_ROOT _ Example SQ Shift

43 Red figuresonthescreenindicatedfallingstocks_ROOT _ Example SQ Right-arc

44 Red figuresonthescreenindicatedfallingstocks_ROOT _ Example SQ Shift

45 Red figureson the screenindicatedfallingstocks_ROOT _ Example SQ Left-arc

46 Red figureson the screenindicatedfallingstocks_ROOT _ Example SQ Right-arc

47 Red figureson thescreen indicatedfallingstocks_ROOT _ Example SQ Reduce

48 Red figures onthescreen indicatedfallingstocks_ROOT _ Example SQ Reduce

49 Red figuresonthescreen indicatedfallingstocks_ROOT _ Example SQ Left-arc

50 Red figure s onthescreen indicatedfallingstocks_ROOT _ Example SQ Right-arc

51 Red figure s onthescreen indicatedfallingstocks_ROOT _ Example SQ Shift

52 Red figuresonthescreen indicated falling stocks_ROOT _ Example SQ Left-arc

53 Red figuresonthescreen indicated falling stocks_ROOT _ Example SQ Right-arc

54 Red figuresonthescreen indicated fallingstocks _ROOT _ Example SQ Reduce

55 Red figuresonthescreenindicate d fallingstocks _ROOT _ Example SQ Reduce

The End QAQA 56