LimitedPriorityQueue refactored to work with arbitrary values, not only pairs of score and value

Document ranking and word ranking is done by wrapping documents and word-score pairs into
a new data type and define an appropriate Ord instance for these types