Home | History | Annotate | Download | only in lib

Lines Matching refs:Fst

17 // Functions and classes to sort arcs in an FST.
24 #include "fst/lib/cache.h"
25 #include "fst/lib/test-properties.h"
27 namespace fst {
29 // Sorts the arcs in an FST according to function object 'comp' of
35 // sorted FST; it takes as argument the input FST's known properties
43 void ArcSort(MutableFst<Arc> *fst, Compare comp) {
46 uint64 props = fst->Properties(kFstProperties, false);
49 for (StateIterator< MutableFst<Arc> > siter(*fst);
54 for (ArcIterator< MutableFst<Arc> > aiter(*fst, s);
59 fst->DeleteArcs(s);
61 fst->AddArc(s, arcs[a]);
64 fst->SetProperties(comp.Properties(props), kFstProperties);
90 ArcSortFstImpl(const Fst<A> &fst, const C &comp,
92 : CacheImpl<A>(opts), fst_(fst.Copy()), comp_(comp) {
96 SetInputSymbols(fst.InputSymbols());
97 SetOutputSymbols(fst.OutputSymbols());
151 for (ArcIterator< Fst<A> > aiter(*fst_, s); !aiter.Done(); aiter.Next())
162 const Fst<A> *fst_;
169 // Sorts the arcs in an FST according to function object 'comp' of
170 // type Compare. This version is a delayed Fst. Comparsion function
175 // properties of the sorted FST; it takes as argument the input FST's
185 class ArcSortFst : public Fst<A> {
196 ArcSortFst(const Fst<A> &fst, const C &comp)
197 : impl_(new ArcSortFstImpl<A, C>(fst, comp, ArcSortFstOptions())) {}
199 ArcSortFst(const Fst<A> &fst, const C &comp, const ArcSortFstOptions &opts)
200 : impl_(new ArcSortFstImpl<A, C>(fst, comp, opts)) {}
202 ArcSortFst(const ArcSortFst<A, C> &fst) :
203 impl_(new ArcSortFstImpl<A, C>(*(fst.impl_))) {}
256 void operator=(const ArcSortFst<A, C> &fst); // Disallow
267 ArcIterator(const ArcSortFst<A, C> &fst, StateId s)
268 : CacheArcIterator< ArcSortFst<A, C> >(fst, s) {
269 if (!fst.impl_->HasArcs(s))
270 fst.impl_->Expand(s);
315 } // namespace fst