Home | History | Annotate | Download | only in lib

Lines Matching defs:fst

17 // Function to sort states of an Fst.
24 #include "fst/lib/mutable-fst.h"
26 namespace fst {
28 // Sorts the input states of an FST, modifying it. ORDER[i] gives the
30 // sorting. ORDER must be a permutation of FST's states ID sequence:
31 // (1, 2, ..., fst->NumStates() - 1).
33 void StateSort(MutableFst<Arc> *fst,
38 CHECK_EQ(order.size(), fst->NumStates());
40 if (fst->Start() == kNoStateId)
43 uint64 props = fst->Properties(kStateSortProperties, false);
49 fst->SetStart(order[fst->Start()]);
51 for (StateIterator< MutableFst<Arc> > siter(*fst);
57 Weight final1 = fst->Final(s1), final2 = Weight::Zero();
59 for (ArcIterator< MutableFst<Arc> > aiter(*fst, s1);
66 final2 = fst->Final(s2);
68 for (ArcIterator< MutableFst<Arc> > aiter(*fst, s2);
73 fst->SetFinal(s2, final1);
74 fst->DeleteArcs(s2);
78 fst->AddArc(s2, arc);
83 fst->SetProperties(props, kFstProperties);
86 } // namespace fst