<< Prev | - Up - | Next >> |
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:
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 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. 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 at its left hand side. We find and add it to the agenda.
1. | |
2. |
is moved from the agenda to the chart. The fundamental rule creates .
1. | |
2. |
is moved to the chart. Applying the fundamental rule creates .
1. | |
2. |
goes to the chart. Step 2d adds a new hypothesis: .
1. | |
2. |
is moved to the chart and combined with by the fundamental rule to form .
1. | |
2. |
is moved to the chart. The fundamental rule gives us .
1. | |
2. |
is moved to the chart. Neither the fundamental rule nor step 2d produce any new edges.
1. |
is moved to the chart. The fundamental rule produces and step 2d predicts .
1. | |
2. |
is moved to the chart. The fundamental rule creates and step 2d predicts
1. | |
2. | |
3. |
is moved to the chart. There are no appropriate edges in the chart to apply the fundamental rule. Step 2d, however, produces .
1. | |
2. | |
3. |
is moved to the chart, but no new edges can be created.
1. | |
2. |
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.
<< Prev | - Up - | Next >> |