24 #include "fst/fstlib.h" 43 int main(
int argc,
char *argv[]) {
45 using namespace kaldi;
50 "Checks whether an FST is stochastic and exits with success if so.\n" 51 "Prints out maximum error (in log units).\n" 53 "Usage: fstisstochastic [ in.fst ]\n";
56 bool test_in_log =
true;
59 po.
Register(
"delta", &delta,
"Maximum error to accept.");
60 po.
Register(
"test-in-log", &test_in_log,
"Test stochasticity in log semiring.");
68 std::string fst_in_filename = po.
GetOptArg(1);
77 std::cout << min.Value() <<
" " << max.Value() <<
'\n';
81 }
catch(
const std::exception &e) {
82 std::cerr << e.what();
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
Fst< StdArc > * ReadFstKaldiGeneric(std::string rxfilename, bool throw_on_err)
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 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.
bool IsStochasticFstInLog(const Fst< StdArc > &fst, float delta, StdArc::Weight *min_sum, StdArc::Weight *max_sum)
bool IsStochasticFst(const Fst< LogArc > &fst, float delta, LogArc::Weight *min_sum, LogArc::Weight *max_sum)
fst::StdArc::Weight Weight
int NumArgs() const
Number of positional parameters (c.f. argc-1).
int main(int argc, char *argv[])
std::string GetOptArg(int param) const