Function rustfst::utils::decode_linear_fst
source · pub fn decode_linear_fst<W: Semiring, F: Fst<W>>(fst: &F) -> Result<FstPath<W>>
Expand description
Decode a linear FST to retrieves the only path recognized by it. A path is composed of the input symbols, the output symbols and the weight (multiplication of the weights of the trs of the path).
§Example
let labels_input = vec![32, 43, 21];
let labels_output = vec![53, 18, 89];
let fst : VectorFst<BooleanWeight> = transducer(&labels_input, &labels_output, BooleanWeight::one());
let path = decode_linear_fst(&fst).unwrap();
assert_eq!(path, FstPath::new(labels_input, labels_output, BooleanWeight::one()));