(beam_entries, k)
return [beam_entries[i] for i in indices]
Prune all but the `k` sequences with highest score from the beam.
Prune all but the `k` sequences with highest score from the beam.
Prune all but the k sequences with highest score from the beam .
def _prune_branches(beam_entries, k):
  """Prune all but the `k` sequences with highest score from the beam."""
  indices = heapq.nlargest(k, range(len(beam_entries)),
                           key=lambda i: beam_entries[i].score)
  return [beam_entries[i] for i in indices]
def _prune_branches ( beam_entries , k ) : indices = heapq . nlargest ( k , range ( len ( beam_entries ) ) , key = lambda i : beam_entries [ i ] . score ) return [ beam_entries [ i ] for i in indices ]