An efficient algorithm that enumerates parses of ambiguous context-free languages is described, and its time and space complexities are discussed. When context-free parsers are used for natural language parsing, pattern recognition, and so forth, there may be a great number of parses for a sentence. One common strategy for efficient enumeration of parses is to assign an appropriate weight to each production, and to enumerate parses in the order of the total weight of all applied production. However, the existing algorithms taking this strategy can be applied only to the problems of limited areas such as regular languages; in the other areas only inefficient exhaustive searches are known. In this paper, we first introduce a hierarchical graph suitable for enumeration. Using this graph, enumeration of parses in the order of acceptablity is equivalent to finding paths of this graph in the order of length. Then, we present an efficient enumeration algorithm with this graph, which can be applied to arbitrary context-free grammars. For enumeration of k parses in the order of the total weight of all applied productions, the time and space complexities of our algorithm are 0(n^3 + kn^2) and 0(n^3 + kn), respectively.
[1]
E. Denardo,et al.
Shortest-Route Methods: 1. Reaching, Pruning, and Buckets
,
1979,
Oper. Res..
[2]
Leslie G. Valiant,et al.
General Context-Free Recognition in Less than Cubic Time
,
1975,
J. Comput. Syst. Sci..
[3]
Michael A. Harrison,et al.
Parsing of General Context-Free Languages
,
1976,
Adv. Comput..
[4]
Bennett L. Fox,et al.
Data Structures and Computer Science Techniques in Operations Research
,
1978,
Oper. Res..
[5]
Tadao Kasami,et al.
An Efficient Recognition and Syntax-Analysis Algorithm for Context-Free Languages
,
1965
.
[6]
Jay Earley,et al.
An efficient context-free parsing algorithm
,
1970,
Commun. ACM.
[7]
Walter L. Ruzzo,et al.
An Improved Context-Free Recognizer
,
1980,
ACM Trans. Program. Lang. Syst..
[8]
Toshihide Ibaraki,et al.
An efficient algorithm for K shortest simple paths
,
1982,
Networks.
[9]
E. Lawler.
A PROCEDURE FOR COMPUTING THE K BEST SOLUTIONS TO DISCRETE OPTIMIZATION PROBLEMS AND ITS APPLICATION TO THE SHORTEST PATH PROBLEM
,
1972
.