1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use std::borrow::Borrow;
use anyhow::Result;
use crate::algorithms::factor_weight::{FactorIterator, FactorWeightFst, FactorWeightOptions};
use crate::fst_traits::{AllocableFst, Fst, MutableFst};
use crate::semirings::WeightQuantize;
pub fn factor_weight<W, F1, B, F2, FI>(fst_in: B, opts: FactorWeightOptions) -> Result<F2>
where
F1: Fst<W>,
B: Borrow<F1>,
F2: MutableFst<W> + AllocableFst<W>,
FI: FactorIterator<W>,
W: WeightQuantize,
{
let fst = FactorWeightFst::<_, _, _, FI>::new(fst_in, opts)?;
fst.compute()
}