dependency parsing
play

Dependency Parsing Guest lecture in Computational Linguistics course - PowerPoint PPT Presentation

Dependency Parsing Guest lecture in Computational Linguistics course Barbara Plank bplank.github.io 11-10-2018 Barbara Plank bplank.github.io Dependency Parsing 11-10-2018 1 / 77 Why Parsing? Barbara Plank bplank.github.io Dependency


  1. Dependency Parsing Guest lecture in Computational Linguistics course Barbara Plank bplank.github.io 11-10-2018 Barbara Plank bplank.github.io Dependency Parsing 11-10-2018 1 / 77

  2. Why Parsing? Barbara Plank bplank.github.io Dependency Parsing 11-10-2018 2 / 77

  3. Why Parsing? For Whom? Barbara Plank bplank.github.io Dependency Parsing 11-10-2018 3 / 77

  4. For Whom? Researchers working on syntax or related topics within other traditions Researchers and application developers interested in using parsers as components in larger systems Barbara Plank bplank.github.io Dependency Parsing 11-10-2018 4 / 77

  5. Two views of grammatical structure So far (a.o.): Constituency structure (a.k.a. phrase structure - CFGs) Today: Dependency structure Barbara Plank bplank.github.io Dependency Parsing 11-10-2018 5 / 77

  6. Today Introduction 1 Transition-based parsing 2 Evaluation 3 Barbara Plank bplank.github.io Dependency Parsing 11-10-2018 6 / 77

  7. Outline Introduction 1 Introduction to UD Transition-based parsing 2 Evaluation 3 Barbara Plank bplank.github.io Dependency Parsing 11-10-2018 7 / 77

  8. The notion of dependency In a dependency grammar, syntactic structures consist of words that are linked pairwise by relations called dependencies . The following slides are based on a tutorial by J.Nivre et al: http: //universaldependencies.org/eacl17tutorial/intro.pdf Barbara Plank bplank.github.io Dependency Parsing 11-10-2018 8 / 77

  9. Introduction to UD Introduction Barbara Plank bplank.github.io Dependency Parsing 11-10-2018 9 / 77

  10. Introduction to UD Introduction Barbara Plank bplank.github.io Dependency Parsing 11-10-2018 10 / 77

  11. Introduction to UD Introduction Barbara Plank bplank.github.io Dependency Parsing 11-10-2018 11 / 77

  12. Introduction to UD Introduction Barbara Plank bplank.github.io Dependency Parsing 11-10-2018 12 / 77

  13. Introduction to UD Introduction Barbara Plank bplank.github.io Dependency Parsing 11-10-2018 13 / 77

  14. Introduction to UD Introduction Barbara Plank bplank.github.io Dependency Parsing 11-10-2018 14 / 77

  15. Introduction to UD Introduction Barbara Plank bplank.github.io Dependency Parsing 11-10-2018 15 / 77

  16. Introduction to UD Introduction Barbara Plank bplank.github.io Dependency Parsing 11-10-2018 16 / 77

  17. Introduction to UD Introduction Barbara Plank bplank.github.io Dependency Parsing 11-10-2018 17 / 77

  18. Introduction to UD Introduction Barbara Plank bplank.github.io Dependency Parsing 11-10-2018 18 / 77

  19. Introduction to UD Introduction Barbara Plank bplank.github.io Dependency Parsing 11-10-2018 19 / 77

  20. Introduction to UD Introduction Barbara Plank bplank.github.io Dependency Parsing 11-10-2018 20 / 77

  21. Introduction to UD Introduction Barbara Plank bplank.github.io Dependency Parsing 11-10-2018 21 / 77

  22. Introduction to UD Introduction Barbara Plank bplank.github.io Dependency Parsing 11-10-2018 22 / 77

  23. Introduction to UD Introduction Barbara Plank bplank.github.io Dependency Parsing 11-10-2018 23 / 77

  24. Introduction to UD Introduction Barbara Plank bplank.github.io Dependency Parsing 11-10-2018 24 / 77

  25. Naming nodes in a dependency rel(head,dep) head vs dependent governor vs modifier regent vs subordinate parent vs child In the convention we use, dependency edges go from head to dependent: nsubj(runs,He) . nsubj He runs Barbara Plank bplank.github.io Dependency Parsing 11-10-2018 25 / 77

  26. Example “They ate the pizza with anchovies” Barbara Plank bplank.github.io Dependency Parsing 11-10-2018 26 / 77

  27. Example “They ate the pizza with anchovies” Barbara Plank bplank.github.io Dependency Parsing 11-10-2018 26 / 77

  28. Dependency Trees: Universal dependencies “They ate the pizza with anchovies” nmod dobj nsubj det case They ate the pizza with anchovies dobj nmod nsubj det case They ate the pizza with anchovies Barbara Plank bplank.github.io Dependency Parsing 11-10-2018 27 / 77

  29. Outline Introduction 1 Transition-based parsing 2 Choosing the Right Actions Representing configurations using feature templates Evaluation 3 Barbara Plank bplank.github.io Dependency Parsing 11-10-2018 28 / 77

  30. What is Transition-based Parsing? One of the two leading approaches for dependency parsing Barbara Plank bplank.github.io Dependency Parsing 11-10-2018 29 / 77

  31. What is Transition-based Parsing? One of the two leading approaches for dependency parsing Approach 1: Transition-based parsing: local decisions Approach 2: Graph-based parsing: global decision (find globally best tree; computationally more expensive; we will not cover this) Barbara Plank bplank.github.io Dependency Parsing 11-10-2018 29 / 77

  32. Why Transition-based Parsing? left to right: similar to how the human brain does it in recent years: state-of-the-art accuracy very fast simple flexible: also suitable for producing phrase-structure trees, CCG derivations, semantic representations... (see next lectures) Barbara Plank bplank.github.io Dependency Parsing 11-10-2018 30 / 77

  33. Transition-based Parsing: How? Intuition: Read sentence word by word, left to right Build up the dependency tree one word at a time: after each word, look at the current parser configuration select a parser operation from a set of operations consulting a machine-learned classifier Barbara Plank bplank.github.io Dependency Parsing 11-10-2018 31 / 77

  34. What is a parser configuration? Configuration: Buffer B (words left, at the start entire sentence) Stack S (last in, first out) Relations R (dependency edges predicted so far, a partial parse) Barbara Plank bplank.github.io Dependency Parsing 11-10-2018 32 / 77

  35. Transition-based parsing Configuration: Buffer B (words left, at the start entire sentence) Stack S (last in, first out) Relations R (dependency edges predicted so far, a partial parse) Configuration C = S , B , R Barbara Plank bplank.github.io Dependency Parsing 11-10-2018 33 / 77

  36. Transition-based parsing Configuration: Buffer B (words left, at the start entire sentence) Stack S (last in, first out) Relations R (dependency edges predicted so far, a partial parse) Configuration C = S , B , R Initial configuration: empty stack, all words on buffer, empty R Final configuration: stack, empty buffer, all edges are in R Barbara Plank bplank.github.io Dependency Parsing 11-10-2018 33 / 77

  37. Transition-based parsing Configuration: Buffer B (words left, at the start entire sentence) Stack S (last in, first out) Relations R (dependency edges predicted so far, a partial parse) Configuration C = S , B , R Initial configuration: empty stack, all words on buffer, empty R Final configuration: stack, empty buffer, all edges are in R Parser does a search through the space of possible configurations Barbara Plank bplank.github.io Dependency Parsing 11-10-2018 33 / 77

  38. Basic actions (simplified) The parser has 3 basic operations (other variants possible): Barbara Plank bplank.github.io Dependency Parsing 11-10-2018 34 / 77

  39. Basic actions (simplified) The parser has 3 basic operations (other variants possible): Shift: Move a word from the buffer to the stack Left: Create an edge to the left Right: Create an edge to the right (This transition system with 3 operations is called arc-standard ) Barbara Plank bplank.github.io Dependency Parsing 11-10-2018 34 / 77

  40. Basic actions (details) The parser has 3 basic operations (other variants possible): Shift: Move a word from the buffer to the stack ( S , i | j | B , A ) → ( S | i , j | B , A ) Left: Create an edge to the left ( S | i | j , B , A ) → ( S | j , B , A ∪ j → i ) [create an edge from j to i, where j is the first and i the second node from the top of the stack; in addition removes i from stack)] Right: Create an edge to the right ( S | i | j , B , A ) → ( S | i , B , A ∪ i → j ) [create an edge from i to j, where i is the second and j the first node on top of the stack; pops j from the stack] Details in http: //stp.lingfil.uu.se/~nivre/master/transition.pdf Barbara Plank bplank.github.io Dependency Parsing 11-10-2018 35 / 77

  41. Transition-based Dependency Parsing buffer = [’They’, ’ate’, ’the’, ’pizza’, ’with’, anchovies’] stack = [] Barbara Plank bplank.github.io Dependency Parsing 11-10-2018 36 / 77

  42. Transition-based Dependency Parsing buffer = [’They’, ’ate’, ’the’, ’pizza’, ’with’, anchovies’] stack = [] while len(buffer) > 0 or len(stack) > 1: action = choose_action(buffer, stack) if action == ’SHIFT’: stack.append(i) elif action == ’LEFT’: parse.add(stack[-2], stack.pop()) elif action == ’RIGHT’: parse.add(i, stack.pop()) Barbara Plank bplank.github.io Dependency Parsing 11-10-2018 36 / 77

  43. Example Stack: [] Buffer: [They, ate, the, pizza, with, anchovies] R: [] Barbara Plank bplank.github.io Dependency Parsing 11-10-2018 37 / 77

  44. Example Stack: [They] Buffer: [ate, the, pizza, with, anchovies] R: [] SHIFT , Barbara Plank bplank.github.io Dependency Parsing 11-10-2018 38 / 77

  45. Example Stack: [They, ate] Buffer: [the, pizza, with, anchovies] R: [] SHIFT , SHIFT Barbara Plank bplank.github.io Dependency Parsing 11-10-2018 39 / 77

Recommend


More recommend