25 #include "fst/fstlib.h" 45 int main(
int argc,
char *argv[]) {
47 using namespace kaldi;
52 "Removes some (but not all) epsilons in an algorithm that will always reduce the number of\n" 53 "arcs+states. Option to preserves equivalence in tropical or log semiring, and\n" 54 "if in tropical, stochasticit in either log or tropical.\n" 56 "Usage: fstrmepslocal [in.fst [out.fst] ]\n";
60 bool stochastic_in_log =
true;
62 "Preserve equivalence in log semiring [false->tropical]\n");
63 po.
Register(
"stochastic-in-log", &stochastic_in_log,
64 "Preserve stochasticity in log semiring [false->tropical]\n");
72 std::string fst_in_filename = po.
GetOptArg(1),
77 if (!use_log && stochastic_in_log) {
79 }
else if (use_log && !stochastic_in_log) {
80 std::cerr <<
"fstrmsymbols: invalid combination of flags\n";
83 VectorFst<LogArc> log_fst;
87 fst =
new VectorFst<StdArc>;
96 }
catch(
const std::exception &e) {
97 std::cerr << e.what();
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
void RemoveEpsLocal(MutableFst< Arc > *fst)
RemoveEpsLocal remove some (but not necessarily all) epsilons in an FST, using an algorithm that is g...
For an extended explanation of the framework of which grammar-fsts are a part, please see Support for...
void PrintUsage(bool print_command_line=false)
Prints the usage documentation [provided in the constructor].
void RemoveEpsLocalSpecial(MutableFst< StdArc > *fst)
As RemoveEpsLocal but takes care to preserve stochasticity when cast to LogArc.
void Register(const std::string &name, bool *ptr, const std::string &doc)
The class ParseOptions is for parsing command-line options; see Parsing command-line options for more...
int Read(int argc, const char *const *argv)
Parses the command line options and fills the ParseOptions-registered variables.
int NumArgs() const
Number of positional parameters (c.f. argc-1).
void WriteFstKaldi(std::ostream &os, bool binary, const VectorFst< Arc > &t)
void ReadFstKaldi(std::istream &is, bool binary, VectorFst< Arc > *fst)
int main(int argc, char *argv[])
std::string GetOptArg(int param) const