12.2 An Example

Let's see an example of the top-down algorithm in action. As in the last chapter, we will parse the sentence Mia danced and we will also use the same grammar. Here it is again:

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

So, our initial chart and agenda will look like shown at the end of the last section. We enter the repeat loop and move the edge \langle 0, 0, S\ \rightarrow\ .\ NP\ VP\rangle to the chart. There is nothing in the chart that we could use to apply the fundamental rule, so we go on to step 2d. \langle 0, 0, S\ \rightarrow\ .\ NP\ VP\rangle is an active edge and as we saw above, step 2d is carried out for active instead of passive edges in the top-down algorithm. We therefore have to look for a grammar rule that has NP at its left hand side. We find NP\ \rightarrow\ PN and add it to the agenda.

1.

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

2.

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

\langle 0, 0, NP\ \rightarrow\ .\ PN\rangle is moved from the agenda to the chart. The fundamental rule creates \langle 0, 1, NP\ \rightarrow\ PN\ .\rangle.

 

1.

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

2.

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

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

1.

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

2.

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

\langle 0, 1, S\ \rightarrow\ PN\ .\ VP\rangle goes to the chart. Step 2d adds a new hypothesis: \langle 1, 1, VP\ \rightarrow\ .\ IV\rangle.

1.

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

2.

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

\langle 1, 1, VP\ \rightarrow\ .\ IV\rangle is moved to the chart and combined with IV\ \rightarrow\ danced\ . by the fundamental rule to form \langle 1, 2, VP\ \rightarrow\ IV\ .\rangle.

1.

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

2.

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

\langle 1, 2, VP\ \rightarrow\ IV\ .\rangle is moved to the chart. The fundamental rule gives us \langle 0, 2, S\ \rightarrow\ NP\ VP\ .\rangle.

 

1.

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

2.

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

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

1.

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

\langle 0, 0, S\ \rightarrow\ .\ NP\ VP\ PP\rangle is moved to the chart. The fundamental rule produces \langle 0, 1, S\ \rightarrow\ NP\ .\ VP\ PP\rangle and step 2d predicts \langle 0, 0, NP\ \rightarrow\ .\ PN\rangle.

1.

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

2.

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

\langle 0, 1, S\ \rightarrow\ NP\ .\ VP\ PP\rangle is moved to the chart. The fundamental rule creates \langle 0, 2, S\ \rightarrow\ NP\ VP\ .\ PP\rangle and step 2d predicts \langle 1, 1, VP\ \rightarrow\ .\ IV\rangle

1.

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

2.

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

3.

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

\langle 0, 2, S\ \rightarrow\ NP\ VP\ .\ PP\rangle is moved to the chart. There are no appropriate edges in the chart to apply the fundamental rule. Step 2d, however, produces \langle 2, 2, PP\ \rightarrow\ .\ P\ NP\rangle.

1.

\langle 2, 2, PP\ \rightarrow\ .\ P\ NP\rangle

2.

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

3.

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

\langle 2, 2, PP\ \rightarrow\ .\ P\ NP\rangle is moved to the chart, but no new edges can be created.

1.

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

2.

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

The two edges which are left on the agenda at this point are both already recorded in the chart. So, they will be popped off the agenda without adding any new edges to it.

 

You should experiment with other examples of this algorithm in action. You should also compare the top-down treatment of Mia danced with the bottom-up treatment that you saw in the last chapter.


Patrick Blackburn and Kristina Striegnitz
Version 1.2.4 (20020829)