'Sort the hyps based on log probs and length.
Args:
hyps: A list of hypothesis.
Returns:
hyps: A list of sorted hypothesis in reverse log_prob order.'

def _BestHyps(self, hyps):

    if FLAGS.normalize_by_length:
        return sorted(hyps, key=(lambda h: (h.log_prob / len(h.tokens))), reverse=True)
    else:
        return sorted(hyps, key=(lambda h: h.log_prob), reverse=True)
