next up previous
Next: Prediction (probabilistictransitive) Up: Coping with recursion Previous: Coping with recursion

Prediction loops

As an example, consider the following simple left-recursive SCFG.

eqnarray5290

where q = 1 - p. Non-probabilistically, the prediction loop at position 0 would stop after producing the states

eqnarray5292

This would leave the forward probabilities at

eqnarray5306

corresponding to just two out of an infinity of possible paths. The correct forward probabilities are obtained as a sum of infinitely many terms, accounting for all possible paths of length 1.

eqnarray5314

In these sums each p corresponds to a choice of the first production, each q to a choice of the second production. If we didn't care about finite computation the resulting geometric series could be computed by letting the prediction loop (and hence the summation) continue indefinitely.

Fortunately, all repeated prediction steps, including those due to left-recursion in the productions, can be collapsed into a single, modified prediction step, and the corresponding sums computed in closed form. For this purpose we need a probabilistic version of the well-known parsing concept of a left corner, which is also at the heart of the prefix probability algorithm of Jelinek:91.

defn5329

The recurrence for tex2html_wrap_inline7701 can be conveniently written in matrix notation

displaymath8192

from which the closed-form solution is derived:

displaymath8193

An existence proof for tex2html_wrap_inline7701 is given in Appendix A. Appendix B.3.1 shows how to speed up the computation of tex2html_wrap_inline7701 by inverting only a reduced version of the matrix tex2html_wrap_inline8269 .

The significance of the matrix tex2html_wrap_inline7701 for the Earley algorithm is that its elements are the sums of the probabilities of the potentially infinitely many prediction paths leading from a state tex2html_wrap_inline8273 to a predicted state tex2html_wrap_inline8275 , via any number of intermediate states.

tex2html_wrap_inline7701 can be computed once for each grammar, and used for table-lookup in the following, modified prediction step.





Andreas Stolcke
Sat Jun 29 21:49:02 PDT 1996