discodop.kbest¶
Extract the k-best derivations from a probabilistic parse forest.
Implementation of Huang & Chiang (2005): Better k-best parsing. https://web.engr.oregonstate.edu/~huanlian/papers/huang-iwpt-correct.pdf
Functions
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
derivsis True).chart.parseforestshould 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.