def print_sample(ex_source, ex_reference, ex_prediction, src_dict, tgt_dict):
 sample_output = u'\n    Source Sentence: {source}\n    Reference Translation: {reference}\n    Predicted Translation: {prediction}\n    '.format(source=' '.join([src_dict[k].decode('utf-8') for k in ex_source]), reference=' '.join([tgt_dict[k].decode('utf-8') for k in ex_reference]), prediction=' '.join([tgt_dict[k].decode('utf-8') for k in ex_prediction]))
 print sample_output.encode('utf-8')

def print_sample ( ex_source , ex_reference , ex_prediction , src_dict , tgt_dict ) : sample_output = u'\n    Source Sentence: {source}\n    Reference Translation: {reference}\n    Predicted Translation: {prediction}\n    ' . format ( source = ' ' . join ( [ src_dict [ k ] . decode ( 'utf-8' ) for k in ex_source ] ) , reference = ' ' . join ( [ tgt_dict [ k ] . decode ( 'utf-8' ) for k in ex_reference ] ) , prediction = ' ' . join ( [ tgt_dict [ k ] . decode ( 'utf-8' ) for k in ex_prediction ] ) ) print sample_output . encode ( 'utf-8' )
print some example predictions .