use priority queue to find n-best sequences

the current implementation (lines 369-378) has a complexity of O(n**2), whereas the priority queue should work in O(n log n).

with a label set of size 50, n-best tagging was about the same speed up to n=10; for n=50, the new implementation was about 6x faster in a small benchmark.