The encode operation allows the representation of a weighted transducer as a weighted automaton,
an unweighted transducer or an unweighted automaton by considering the pair
(input label, output), the pair (input label, weight) or the triple (input label,
output label, weight) as a single label depending on the value
of the encode flags: encode_labels and encode_weights.