format_translation_output
- opennmt.utils.format_translation_output(sentence, score=None, token_level_scores=None, attention=None, alignment_type=None)[source]
Formats a translation output with possibly scores, alignments, etc., e.g:
1.123214 ||| Hello world ||| 0.30907777 0.030488174 ||| 0-0 1-1
- Parameters
sentence – The translation to output.
score – If set, attach the score.
token_level_scores – If set, attach the token level scores.
attention – The attention vector.
alignment_type – The type of alignments to format (can be: “hard”, “soft”).