rustfst 1.3.0

Library for constructing, combining, optimizing, and searching weighted finite-state transducers (FSTs).
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use anyhow::Result;

use crate::fst_traits::MutableFst;
use crate::Semiring;

pub fn epsilon_machine<W: Semiring, F: MutableFst<W>>() -> Result<F> {
    let mut fst = F::new();
    let s = fst.add_state();
    fst.set_start(s)?;
    fst.set_final(s, W::one())?;
    Ok(fst)
}