def _expand_nbest_translation(translation: Translation) -> List[Translation]:
    """
    Expand nbest translations in a single Translation object to one Translation
        object per nbest translation.

    :param translation: A Translation object.
    :return: A list of Translation objects.
    """
    nbest_list = []  # type = List[Translation]
    for target_ids, attention_matrix, score in zip(translation.nbest_translations.target_ids_list,
                                                   translation.nbest_translations.attention_matrices,
                                                   translation.nbest_translations.scores):
        nbest_list.append(Translation(target_ids, attention_matrix, score, translation.beam_histories,
                                      estimated_reference_length=translation.estimated_reference_length))

    return nbest_list
def _expand_nbest_translation ( translation : Translation ) -> List [ Translation ] : nbest_list = [ ] for target_ids , attention_matrix , score in zip ( translation . nbest_translations . target_ids_list , translation . nbest_translations . attention_matrices , translation . nbest_translations . scores ) : nbest_list . append ( Translation ( target_ids , attention_matrix , score , translation . beam_histories , estimated_reference_length = translation . estimated_reference_length ) ) return nbest_list
Expand nbest translations in a single Translation object to one Translation
        object per nbest translation.

    :param translation: A Translation object.
    :return: A list of Translation objects.