def _concat_nbest_translations(translations: List[Translation], stop_ids: Set[int],
                               length_penalty: LengthPenalty,
                               brevity_penalty: Optional[BrevityPenalty] = None) -> Translation:
    """
    Combines nbest translations through concatenation.

    :param translations: A list of translations (sequence starting with BOS symbol,
        attention_matrix), score and length.
    :param stop_ids: The EOS symbols.
    :param length_penalty: LengthPenalty.
    :param brevity_penalty: Optional BrevityPenalty.
    :return: A concatenation of the translations with a score.
    """
    expanded_translations = (_expand_nbest_translation(translation) for translation in translations)

    concatenated_translations = []  # type: List[Translation]

    for translations_to_concat in zip(*expanded_translations):
        concatenated_translations.append(_concat_translations(translations=list(translations_to_concat),
                                                              stop_ids=stop_ids,
                                                              length_penalty=length_penalty,
                                                              brevity_penalty=brevity_penalty))

    return _reduce_nbest_translations(concatenated_translations)
Combines nbest translations through concatenation.

    :param translations: A list of translations (sequence starting with BOS symbol,
        attention_matrix), score and length.
    :param stop_ids: The EOS symbols.
    :param length_penalty: LengthPenalty.
    :param brevity_penalty: Optional BrevityPenalty.
    :return: A concatenation of the translations with a score.