Macro rustfst::fst_path [−][src]
macro_rules! fst_path { ( $( $x:expr ),*) => { ... }; ( $( $x:expr ),* => $( $y:expr ),* ) => { ... }; ( $( $x:expr ),* ; $weight:expr) => { ... }; ( $( $x:expr ),* => $( $y:expr ),* ; $weight:expr) => { ... }; }
Expand description
Creates a Path containing the arguments.
There are multiple forms to this macro :
- Create an unweighted acceptor path :
let path : FstPath<IntegerWeight> = fst_path![1,2,3]; assert_eq!(path.ilabels, vec![1,2,3]); assert_eq!(path.olabels, vec![1,2,3]); assert_eq!(path.weight, IntegerWeight::one());
- Create an unweighted transducer path :
let path : FstPath<IntegerWeight> = fst_path![1,2,3 => 1,2,4]; assert_eq!(path.ilabels, vec![1,2,3]); assert_eq!(path.olabels, vec![1,2,4]); assert_eq!(path.weight, IntegerWeight::one());
- Create a weighted acceptor path :
let path : FstPath<IntegerWeight> = fst_path![1,2,3; 18]; assert_eq!(path.ilabels, vec![1,2,3]); assert_eq!(path.olabels, vec![1,2,3]); assert_eq!(path.weight, IntegerWeight::new(18));
- Create a weighted transducer path :
let path : FstPath<IntegerWeight> = fst_path![1,2,3 => 1,2,4; 18]; assert_eq!(path.ilabels, vec![1,2,3]); assert_eq!(path.olabels, vec![1,2,4]); assert_eq!(path.weight, IntegerWeight::new(18));