15 #ifndef TASK_HIFST_OPTIMIZE_HPP 16 #define TASK_HIFST_OPTIMIZE_HPP 26 template<
class Arc = fst::LexStdArc>
28 typedef typename Arc::Label Label;
29 typedef typename Arc::Weight Weight;
44 uint nstatesthreshold = std::numeric_limits<uint>::max() ,
45 bool check =
true )
const {
46 if (fst->NumStates() > nstatesthreshold || !
check ) {
47 LINFO (
"Only rm epsilons...");
48 fst::RmEpsilon<Arc> (fst);
51 LINFO (
"Full optimization");
57 inline void optimize ( fst::VectorFst<Arc> *fst )
const {
60 fst::Determinize (fst::RmEpsilonFst<Arc> (*fst), fst);
71 template<
class Arc = fst::LexStdArc>
73 typedef typename Arc::Label Label;
74 typedef typename Arc::Weight Weight;
87 uint numstatesthreshold )
const {
#define ZDISALLOW_COPY_AND_ASSIGN(TypeName)
OptimizeMachineNoDetMin()
void setAlignMode(bool align)
fst::VectorFst< Arc > * EncodeDeterminizeMinimizeDecode(fst::VectorFst< Arc > *myfst)
Encodes, determinizes, minimizes and decodes an fst.
bool check(const char *expression, const char *message, const char *filename, const char *function, uint line, bool abort=true)
Function that reports as many details as possible if the assertion USER_CHECK has failed...
void operator()(fst::VectorFst< Arc > *fst, uint nstatesthreshold=std::numeric_limits< uint >::max(), bool check=true) const
OptimizeMachine(bool align=false)