Clase 10 - Chart Parser

  • November 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Clase 10 - Chart Parser as PDF for free.

More details

  • Words: 1,137
  • Pages: 29
Computational Linguistics ´ Damir Cavar [email protected] Indiana University Linguistics Department February 14, 2006

´ © 2006 by Damir Cavar, Indiana University

Parsing Strategy

• Improvement of parser – Ordering of rules: more common rules first – Number of symbols in RHS cannot be bigger than number of symbols and/or terminals in the input – Tagging the input first – Depth-first rather than breadth-first with respect to the agenda ´ © 2006 by Damir Cavar, Indiana University

1

Parsing Strategy

• Improvement of parser – Ordering of rules: more common rules first – Try PSG1.txt PSG2.txt

´ © 2006 by Damir Cavar, Indiana University

2

Parsing Strategy

• Improvement of parser – Number of symbols in RHS cannot be bigger than number of symbols and/or terminals in the input – Try: TDAPa2.py

´ © 2006 by Damir Cavar, Indiana University

3

Parsing Strategy

• Improvement of parser – Tagging the input first – Try: TDAPa3.py

´ © 2006 by Damir Cavar, Indiana University

4

Parsing Strategy

• Improvement of parser – Depth-first rather than breadth-first with respect to the agenda – Try: TDAPa4.py

´ © 2006 by Damir Cavar, Indiana University

5

Parsing Strategy

• Comparison Top-down vs. Bottom-up • Try: BUAParser-Files

´ © 2006 by Damir Cavar, Indiana University

6

Parsing Strategy

• Recursive function calls vs. loop • No stack overflows in: BUAParserD2.py

´ © 2006 by Damir Cavar, Indiana University

7

Parsing Strategy • Problems – Dependencies between tokens in the clause ∗ agreement, binding, negative polarity and other particles, idioms, anaphoric relations, periphrastic constructions etc. – Structures depend on the properties of tokens and vice versa ∗ transitivity of verbs, selectional properties ´ © 2006 by Damir Cavar, Indiana University

8

Parsing Strategy

• Problems – Grammars ∗ recursion: unlimited number of elements on the agenda? ∗ empty elements or traces

´ © 2006 by Damir Cavar, Indiana University

9

Assignment

• Discuss language properties and the problems for parsing, give examples from a language of your choice for: – – – –

lexical ambiguity structural ambiguity lexical dependencies structural dependencies

´ © 2006 by Damir Cavar, Indiana University

10

Assignment

• Discuss problems for the parsing strategies we tried so far. • Discuss possibilities how to tackle these problems. • How would you change or algorithm and the code of the different parsers to keep track of the structures (get a resulting syntactic tree)? ´ © 2006 by Damir Cavar, Indiana University

11

Parsing Strategy

• Problems observed – Reanalysis of already analyzed constituents – Search through all grammar rules • Solution – Memorize analyzed constituents – Choose appropriate rules ´ © 2006 by Damir Cavar, Indiana University

12

Parsing Strategy

• Solution – Chart Parsing ∗ Chart as memory ∗ Selection of relevant rules from grammar

´ © 2006 by Damir Cavar, Indiana University

13

Chart Parsing

• Chart: – Storage for complete and incomplete constituents – Edges ∗ Dotted rule ∗ Index

´ © 2006 by Damir Cavar, Indiana University

14

Chart Parsing

• Chart: – Storage for complete and incomplete constituents – Edges ∗ Dotted rule: VP → V • NP ∗ Index: · Left and right position of the edge span · Position of the dot in the RHS ´ © 2006 by Damir Cavar, Indiana University

15

Chart Parsing

• Edges: – Dotted rule: VP → V • NP How much of the input at which position matches which part of the RHS of the rule? – Example: ∗ Input: John loves Mary ∗ Edge: (1, 2, 1, V → loves •) ´ © 2006 by Damir Cavar, Indiana University

16

Chart Parsing

• Edges: – Inactive edge: (1, 2, 1, V → loves •) ∗ Complete constituent – Active edge: (1, 2, 1, VP → V • NP) ∗ Incomplete constituent

´ © 2006 by Damir Cavar, Indiana University

17

Chart Parsing

• Adding edges to chart: – Initialization – Rule invocation: Matching edges with rules – Fundamental rule: Matching active and inactive edges on the chart

´ © 2006 by Damir Cavar, Indiana University

18

Chart Parsing

• Initialization – Bottom-up strategy: – For every token add an inactive edge to chart: ∗ edge(0, 1, 1, N → John •) ∗ edge(1, 2, 1, V → kissed •) ∗ edge(2, 3, 1, N → Mary •)

´ © 2006 by Damir Cavar, Indiana University

19

Chart Parsing

• Initialization – Top-down strategy: – For every token add an inactive edge to chart. – For every rule with start-symbol in LHS add active edge to chart: ∗ edge(0, 1, 0, S → • NP VP)

´ © 2006 by Damir Cavar, Indiana University

20

Chart Parsing

• Rule Invocation – Bottom-up strategy: – For every inactive edge on chart: ∗ Find rules that have its LHS on their left periphery in RHS ∗ Create new edges and add to chart.

´ © 2006 by Damir Cavar, Indiana University

21

Chart Parsing

• Rule Invocation – Example: ∗ Inactive edge: edge(0, 1, 1, N → John •) ∗ Rule: NP → N ∗ New edge: edge(0, 0, 0, NP → • N)

´ © 2006 by Damir Cavar, Indiana University

22

Chart Parsing

• Fundamental Rule – Move inactive edge from agenda to chart – For inactive edge find edge that expects it ∗ edge(0, 1, 1, NP → N •) ∗ edge(0, 0, 0, S → • NP VP) – Add resulting edge to agenda: ∗ edge(0, 1, 1, S → NP • VP) ´ © 2006 by Damir Cavar, Indiana University

23

Chart Parsing

• Bottom-up: 1: Initialize agenda 2: Repeat until edges in agenda Process first edge on agenda If edge inactive: move inactive edge to chart Function RuleInvocation Function FundamentalRule

• Result:

If chart contains over-spanning edges, these represent possible parses of the input.

´ © 2006 by Damir Cavar, Indiana University

24

Chart Parsing • Process example: – Grammar PSG1.txt

´ © 2006 by Damir Cavar, Indiana University

25

Chart Parsing • Example implementations: – Charty.zip – ChartyOO.zip

´ © 2006 by Damir Cavar, Indiana University

26

Chart Parsing • Step by step – Initialize chart with the next word of the utterance, i. e. create edge with the lexical rule – Find rules in the grammar that consume the symbol of the inactive edges on the chart, i. e. extend the chart with edges that have LHS-symbols of inactive edges at the left periphery of their RHS

´ © 2006 by Damir Cavar, Indiana University

27

Chart Parsing • Step by step – Create new edges by combining an active edge with an inactive edge: ∗ the end of the one is the beginning of the other ∗ the expectation symbol of the active edge corresponds with the LHS of the inactive edge

´ © 2006 by Damir Cavar, Indiana University

28

Related Documents

Clase 10 - Chart Parser
November 2019 11
Clase 10 - Chart Parser 2
November 2019 11
Clase 10
May 2020 8
Clase 10
July 2020 6
Clase 10
November 2019 18