def compute_bleu(reference_corpus_list, translation_corpus, tokenized=True,<EOL>tokenizer='<STR_LIT>', max_n=<NUM_LIT:4>, smooth=False, lower_case=False,<EOL>bpe=False, split_compound_word=False):
precision_numerators = [<NUM_LIT:0> for _ in range(max_n)]<EOL>precision_denominators = [<NUM_LIT:0> for _ in range(max_n)]<EOL>ref_length, trans_length = <NUM_LIT:0>, <NUM_LIT:0><EOL>for references in reference_corpus_list:<EOL><INDENT>assert len(references) == len(translation_corpus),'<STR_LIT>'<EOL><DEDENT>if tokenized:<EOL><INDENT>assert isinstance(reference_corpus_list[<NUM_LIT:0>][<NUM_LIT:0>], LIST_TYPES) andisinstance(translation_corpus[<NUM_LIT:0>], LIST_TYPES),'<STR_LIT>''<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>assert isinstance(reference_corpus_list[<NUM_LIT:0>][<NUM_LIT:0>], six.string_types) andisinstance(translation_corpus[<NUM_LIT:0>], six.string_types),'<STR_LIT>''<STR_LIT>'<EOL><DEDENT>for references, translation in zip(zip(*reference_corpus_list), translation_corpus):<EOL><INDENT>if not tokenized:<EOL><INDENT>references = [TOKENIZERS[tokenizer](reference).split() for reference in references]<EOL>translation = TOKENIZERS[tokenizer](translation).split()<EOL><DEDENT>if bpe:<EOL><INDENT>references = [_bpe_to_words(reference) for reference in references]<EOL>translation = _bpe_to_words(translation)<EOL><DEDENT>if split_compound_word:<EOL><INDENT>references = [_split_compound_word(reference) for reference in references]<EOL>translation = _split_compound_word(translation)<EOL><DEDENT>if lower_case:<EOL><INDENT>references = [[w.lower() for w in reference] for reference in references]<EOL>translation = [w.lower() for w in translation]<EOL><DEDENT>trans_len = len(translation)<EOL>trans_length += trans_len<EOL>ref_length += _closest_ref_length(references, trans_len)<EOL>for n in range(max_n):<EOL><INDENT>matches, candidates = _compute_precision(references, translation, n + <NUM_LIT:1>)<EOL>precision_numerators[n] += matches<EOL>precision_denominators[n] += candidates<EOL><DEDENT><DEDENT>precision_fractions = [(precision_numerators[n], precision_denominators[n])<EOL>for n in range(max_n)]<EOL>smooth_const = <NUM_LIT:0><EOL>if smooth:<EOL><INDENT>smooth_const = <NUM_LIT:1><EOL><DEDENT>precisions = _smoothing(precision_fractions, smooth_const)<EOL>if min(precisions) > <NUM_LIT:0>:<EOL><INDENT>precision_log_average = sum(math.log(p) for p in precisions) / max_n<EOL>precision_exp_log_average = math.exp(precision_log_average)<EOL><DEDENT>else:<EOL><INDENT>precision_exp_log_average = <NUM_LIT:0><EOL><DEDENT>bp = _brevity_penalty(ref_length, trans_length)<EOL>bleu = precision_exp_log_average*bp<EOL>return bleu, precisions, bp, ref_length, trans_length<EOL>
r"""Compute bleu score of translation against references.

    Parameters
    ----------
    reference_corpus_list: list of list(list(str)) or list of list(str)
        list of list(list(str)): tokenized references
        list of list(str): plain text
        List of references for each translation.
    translation_corpus: list(list(str)) or list(str)
        list(list(str)): tokenized translation
        list(str): plain text
        Translations to score.
    tokenized: bool, default True
        Whether the inputs has been tokenized.
    tokenizer: str or None, default '13a'
        '13a': follow the tokenizer in mteval-v13a.pl
        'intl': follow the international tokenizer in mteval-v14.pl
        None: identity mapping on the string.
        This option is ignored if tokenized is True
    max_n: int, default 4
        Maximum n-gram order to use when computing BLEU score.
    smooth: bool, default False
        Whether or not to compute smoothed bleu score.
    lower_case: bool, default False
        Whether or not to use lower case of tokens
    split_compound_word: bool, default False
        Whether or not to split compound words
        "rich-text format" --> rich ##AT##-##AT## text format.
    bpe: bool, default False
        Whether or not the inputs are in BPE format

    Returns
    -------
    5-Tuple with the BLEU score, n-gram precisions, brevity penalty,
        reference length, and translation length