Faster k-best with heaps.
Better k-best from grammar using heapq.