(examples, tgt_dict, num_batches, batch_size, eos=0)
return [" ".join([tgt_dict[k].decode("utf-8") for k in sent if k != eos]) for sent in sents]
BLEU score
BLEU score
BLEU score
def bleu_format(examples, tgt_dict, num_batches, batch_size, eos=0):
    """
    BLEU score
    """
    sents = [examples[ex, b, :] for b, ex in itt.product(range(num_batches), range(batch_size))]
    return [" ".join([tgt_dict[k].decode("utf-8") for k in sent if k != eos]) for sent in sents]
def bleu_format ( examples , tgt_dict , num_batches , batch_size , eos = 0 ) : sents = [ examples [ ex , b , : ] for b , ex in itt . product ( range ( num_batches ) , range ( batch_size ) ) ] return [ " " . join ( [ tgt_dict [ k ] . decode ( "utf-8" ) for k in sent if k != eos ] ) for sent in sents ]