11.5 Bottom-up Active Chart Parsing

Now that we know about active edges, the fundamental rule, and agendas, it's time to put all these ingredients together and look at a concrete chart parsing algorithm. The bottom-up algorithm we shall use is essentially the general algorithm just studied, but with the details filled in to make it work bottom-up. To understand it, let's go through it step by step using an example.

Suppose we want to analyze the sentence "Mia danced" using the following grammar.

S\ \rightarrow\ N\!P\ V\!P

S\ \rightarrow\ N\!P\ V\!P\ P\!P

NP \rightarrow\ PN

VP \rightarrow\ IV

PP \rightarrow\ P\ NP

PN \rightarrow\ mia

IV \rightarrow\ danced

First, we have to initialize the chart and the agenda (step 1 of the general algorithm). The chart initialization works exactly like for the passive chart parser. So, the initial chart for the sentence Mia danced looks like this:

The initial agenda looks like this:

1.

\langle 0, 1, PN\ \rightarrow\ mia\ .\rangle

2.

\langle 1, 2, IV\ \rightarrow\ danced\ .\rangle

For all words of the input we have added passive edges saying of which category the they are and what is their position in the sentence. The edge \langle 0, 1, PN\ \rightarrow\ mia\ .\rangle, for instance, is a passive edge (the dot is at the very end) that says that there is a PN between positions 0 and 1. This edge was added because we have the rule PN \rightarrow mia in our grammar.

Now that the initialization process is out of the way, we get to step 2, the ``repeat'' part of our general algorithm. The first thing we do is to take the first arc of the agenda (step 2a). In our example that's \langle 0, 1, PN\ \rightarrow\ mia\ .\rangle. We then check whether it is aready recorded in the chart (step 2b). That's not the case, so we add it:

Next, we try to apply the fundamental rule to the new arc (step 2c). The fundamental rule lets us combine an active arc with a passive arc that is immediately to the right of the active one. Since the arc we are working with is passive, we have to find an active arc to the left of, or more precisely, we have to find an active arc that's ending in position 0. There is no such arc, so we cannot do anything here. We go on to step 2d.

The general algorithm tells us that we have to build new hypotheses in this step. Let's see what that means for the bottom-up case. In bottom-up parsing, we always build the parse tree from the bottom upwards, i.e., we combine already completed constituents to form bigger ones. Therefore, we only apply step 2d to passive arcs when working bottom-up; we only predict new constituents based on already completed ones.

In our example we are dealing with a passive arc at the moment (\langle 0, 1, PN\ \rightarrow\ mia\rangle). The prediction of hypotheses then works as follows. We look for grammar rules such that the first symbol on the right hand side of these rules is the same as the left hand side of the arc (which PN in our case). NP\ \rightarrow\ PN is such a rule, for example. We then build active edges for all of these rules. These edges start in the same position as the arc we were looking at, end in exactly that same position, and have the dot right after the arrow. Like this: \langle 0, 0, NP\ \rightarrow\ .\ PN\rangle. This edges is the hypothesis that we might be able to build an NP starting in 0. To do so we still have to find a PP, also starting in 0. As we have already found a PP starting in 0, that's a sensible hypothesis to make. If there were more suitable rules, we would build an active edge for each of them.

Summing up, the instantiation of step 2d for a bottom-up strategy is as follows: If the arc is passive and has category C as its left hand side, then look for grammar rules that has C as the first symbol after the arrow. Build active edges starting and ending in the end point of the arc for all of these rules. The dot is right behind the arrow.

We add all new edges to the agenda and are now at the end of the first round through the repeat loop of step 2. The chart and agenda look as follows:

1.

\langle 0, 0, NP\ \rightarrow\ .\ PN\rangle

2.

\langle 1, 2, IV\ \rightarrow\ danced\ .\rangle

The agenda is not empty, yet, so let's start the 2nd round. The first part of this should be clear: we simply place the top of the agenda, that is, the active edge \langle 0, 0, NP\ \rightarrow\ .\ PN\rangle, on the chart. To apply the fundamental rule (step 2c) we have to find a passive edge in the chart that starts in position 0 (the end point of the active edge). There is one; namely, \langle 0, 1, PN\ \rightarrow\ mia\rangle. We can therefore build the edge \langle 0, 1, NP\ \rightarrow\ PN\ .\rangle (go back to Section 11.2 if you don't see how this works) and add it to the agenda. As step 2d only applies to passive edges we skip it. The current state of chart and agenda are:

1.

\langle 0, 1, NP\ \rightarrow\ PN\ .\rangle

2.

\langle 1, 2, IV\ \rightarrow\ danced\ .\rangle

In the next round \langle 0, 1, NP\ \rightarrow\ PN\ .\rangle will be moved from the agenda to the chart. Step 2c doesn't produce any new edges, but in step 2d the active edges \langle S\ \rightarrow\ NP\ VP\rangle and \langle S\ \rightarrow\ NP\ VP\ PP\rangle will be added to the agenda. Chart and agenda then look as follows.

 

1.

\langle 0, 0, S\ \rightarrow\ .\ NP\ VP\rangle

2.

\langle 0, 0, S\ \rightarrow\ .\ NP\ VP\ PP\rangle

3.

\langle 1, 2, IV\ \rightarrow\ danced\ .\rangle

Next, we move \langle 0, 0, S\ \rightarrow\ .\ NP\ VP\rangle from the agenda to the chart. Applying the fundamental rule in step 2c gives us the new edge \langle 0, 1, S\ \rightarrow\ NP\ .\ VP\rangle.

1.

\langle 0, 1, S\ \rightarrow\ NP\ .\ VP\rangle

2.

\langle 0, 0, S\ \rightarrow\ .\ NP\ VP\ PP\rangle

3.

\langle 1, 2, IV\ \rightarrow\ danced\ .\rangle

\langle 0, 1, S\ \rightarrow\ NP\ .\ VP\rangle is moved to the chart. No new edge can be built.

1.

\langle 0, 0, S\ \rightarrow\ .\ NP\ VP\ PP\rangle

2.

\langle 1, 2, IV\ \rightarrow\ danced\ .\rangle

\langle 0, 0, S\ \rightarrow\ .\ NP\ VP\ PP\rangle is moved to the chart. The fundamental rule creates \langle 0, 1, S\ \rightarrow\ NP\ .\ VP\ PP\rangle

1.

\langle 0, 1, S\ \rightarrow\ NP\ .\ VP\ PP\rangle

2.

\langle 1, 2, IV\ \rightarrow\ danced\ .\rangle

\langle 0, 1, S\ \rightarrow\ NP\ .\ VP\ PP\rangle is moved to the chart. No new edge is created.

1.

\langle 1, 2, IV\ \rightarrow\ danced\ .\rangle

\langle 1, 2, IV\ \rightarrow\ danced\ .\rangle is moved to the chart. Step 2d predicts VP\ \rightarrow\ .\ IV.

1.

\langle 1, 2, VP\ \rightarrow\ .\ IV\rangle

\langle 1, 2, VP\ \rightarrow\ .\ IV\rangle is moved to the chart. The fundamental rule produces \langle 1, 2, VP\ \rightarrow\ IV\ .\rangle.

1.

\langle 1, 2, VP\ \rightarrow\ IV\ .\rangle

\langle 1, 2, VP\ \rightarrow\ IV\ .\rangle is moved to the chart. The fundamental rule produces \langle 0, 2, S\ \rightarrow\ NP\ VP\ .\rangle and \langle 0, 2, S\ \rightarrow\ NP\ VP\ .\ PP\rangle. Step 2d, although applicable as \langle 1, 2, VP\ \rightarrow\ IV\ .\rangle is a passive edge, produces no new rules.

1.

\langle 0, 2, S\ \rightarrow\ NP\ VP\ .\rangle

2.

\langle 0, 2, S\ \rightarrow\ NP\ VP\ .\ PP\rangle

\langle 0, 2, S\ \rightarrow\ NP\ VP\ .\rangle is moved to the chart. Neither step 2c nor step 2d produce any new rules.

1.

\langle 0, 2, S\ \rightarrow\ NP\ VP\ .\ PP\rangle

\langle 0, 2, S\ \rightarrow\ NP\ VP\ .\ PP\rangle is moved to the chart. Again, no new edges can be built.

The agenda is now empty, so we exit the repeat. This takes us to step 3. And yes, we do have a passive s node from the first to the last node, so we have succeeded in recognizing the sentence.


Patrick Blackburn and Kristina Striegnitz
Version 1.2.4 (20020829)