public static PrecomputedComposeFst precomputeInner ( Fst fst2 , Semiring semiring ) { fst2 . throwIfInvalid ( ) ; MutableFst mutableFst = MutableFst . copyFrom ( fst2 ) ; WriteableSymbolTable table = mutableFst . getInputSymbols ( ) ; int e1index = getOrAddEps ( table , true ) ; int e2index = getOrAddEps ( table , false ) ; String eps1 = table . invert ( ) . keyForId ( e1index ) ; String eps2 = table . invert ( ) . keyForId ( e2index ) ; augment ( AugmentLabels . INPUT , mutableFst , semiring , eps1 , eps2 ) ; ArcSort . sortByInput ( mutableFst ) ; MutableFst filter = makeFilter ( table , semiring , eps1 , eps2 ) ; ArcSort . sortByInput ( filter ) ; return new PrecomputedComposeFst ( eps1 , eps2 , new ImmutableFst ( mutableFst ) , semiring , new ImmutableFst ( filter ) ) ; }
Pre - processes a FST that is going to be used on the right hand side of a compose operator many times