(ex_source, ex_reference, ex_prediction, src_dict, tgt_dict)
Print some example predictions.
Print some example predictions.
Print some example predictions .
def print_sample(ex_source, ex_reference, ex_prediction, src_dict, tgt_dict):
    """
    Print some example predictions.
    """
    sample_output = u"""
    Source Sentence: {source}
    Reference Translation: {reference}
    Predicted Translation: {prediction}
    """.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"""
    Source Sentence: {source}
    Reference Translation: {reference}
    Predicted Translation: {prediction}
    """ . 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" ) )