Extract the k-best derivations from a probabilistic parse forest.

Implementation of Huang & Chiang (2005): Better k-best parsing. http://www.cis.upenn.edu/~lhuang3/huang-iwpt-correct.pdf


lazykbest(Chart chart, int k, bool derivs=True) Wrapper function to run lazykthbest.
partitionincompletechart(Chart chart, start, end) Return list of parseable intervals (a, b) of an incomplete chart.
discodop.kbest.lazykbest(Chart chart, int k, bool derivs=True)

Wrapper function to run lazykthbest.

Produces the ranked chart, as well as derivations as strings (when derivs is True). chart.parseforest should be a monotone hypergraph; should be acyclic unless probabilities resolve the cycles (maybe nonzero weights for unary productions are sufficient?).

Parameters:k – the number of derivations to enumerate.