Presentation is loading. Please wait.

Presentation is loading. Please wait.

25.11.2003csa3050: Parsing Algorithms 11 CSA350: NLP Algorithms Parsing Algorithms 1 Top Down Bottom-Up Left Corner.

Similar presentations


Presentation on theme: "25.11.2003csa3050: Parsing Algorithms 11 CSA350: NLP Algorithms Parsing Algorithms 1 Top Down Bottom-Up Left Corner."— Presentation transcript:

1 25.11.2003csa3050: Parsing Algorithms 11 CSA350: NLP Algorithms Parsing Algorithms 1 Top Down Bottom-Up Left Corner

2 25.11.2003csa3050: Parsing Algorithms 12 References This lecture is based on material found in Juracky & Martin chapter 10. Relevant material available from Vince.

3 25.11.2003csa3050: Parsing Algorithms 13 Simple Grammar fl | || | ||

4 25.11.2003csa3050: Parsing Algorithms 14 Parsing Problem Find all trees such that: –root is S –leaves exactly cover all the input words, e.g. fl

5 25.11.2003csa3050: Parsing Algorithms 15 Parsing as Search Search within a space defined by –Start State –Goal State –State to state transformations Shape of space depends on parsing strategy Two distinct strategies for finding the parse trees: –Top down –Bottom up

6 25.11.2003csa3050: Parsing Algorithms 16 Top Down Top down parser tries to build from the root node S down to the leaves by replacing nodes with non-terminal labels with RHS of corresponding grammar rules. Nodes with pre-terminal (word class) labels are compared to input words.

7 25.11.2003csa3050: Parsing Algorithms 17 Top Down Search Space Start node → Goal node ↓

8 25.11.2003csa3050: Parsing Algorithms 18 Bottom Up Each state is a forest of trees. Start node is a forest of nodes labelled with pre-terminal categories (word classes derived from lexicon) Transformations look for places where RHS of rules can fit. Any such place is replaced with a node labelled with LHS of rule.

9 25.11.2003csa3050: Parsing Algorithms 19 Bottom Up Search Space fl

10 25.11.2003csa3050: Parsing Algorithms 110 Top Down vs Bottom Up Top down –For: Never wastes time exploring trees that cannot be derived from S –Against: Can generate trees that are not consistent with the input Bottom up –For: Never wastes time building trees that cannot lead to input text segments. –Against: Can generate subtrees that can never lead to an S node.

11 25.11.2003csa3050: Parsing Algorithms 111 Development of a Concrete Strategy Combine best features of both top down and bottom up strategies. –Top down, grammar directed control. –Bottom up filtering. Examination of alternatives in parallel uses too much memory. Depth first strategy using agenda-based control.

12 25.11.2003csa3050: Parsing Algorithms 112 Top Down Algorithm

13 25.11.200313 Derivation top down, left-to- right, depth first

14 25.11.2003csa3050: Parsing Algorithms 114 A Problem with the Algorithm Note that the first three steps of the parse involve a failed attempt to expand the first rule S → NP VP. The parser recursively expands the leftmost NT of this rule (NP). While all this work is going on, the input is not even consulted! Only when a terminal symbol is encountered is the input compared and the failure discovered. This is pretty inefficient.

15 25.11.2003csa3050: Parsing Algorithms 115 Bottom Up Filtering We know the current input word must serve as the first word in the derivation of the unexpanded node the parser is currently processing. Therefore the parser should not consider grammar rule for which the current word cannot serve as the "left corner" The left corner is the first word (or preterminal node) along the left edge of a derivation.

16 25.11.2003csa3050: Parsing Algorithms 116 Left Corner The nodes Verb and prefer are each left corners of VP fl

17 25.11.2003csa3050: Parsing Algorithms 117 Left Corner B is a left corner of A iff A  * Bα for non-terminal A, pre-terminal B and symbol string α. Possible left corners of all non-terminal categories can be determined in advance and placed in a table.

18 25.11.2003csa3050: Parsing Algorithms 118 Example of Left Corner Table CategoryLeft Corners S NP Nominal VP Det, Proper-Noun, Aux, Verb Det, Proper-Noun Noun Verb

19 25.11.2003csa3050: Parsing Algorithms 119 How to use the Left Corner Table If attempting to parse category A, only consider rules A → Bα for which category(current input)  LeftCorners(B) S → NP VP S → Aux NP VP S → VP

20 25.11.2003csa3050: Parsing Algorithms 120 Next Week Problems with top down parser left recursion repeated work Early Algorithm Assignment See J & M ch 10


Download ppt "25.11.2003csa3050: Parsing Algorithms 11 CSA350: NLP Algorithms Parsing Algorithms 1 Top Down Bottom-Up Left Corner."

Similar presentations


Ads by Google