23 #include "fst/fstlib.h" 36 int main(
int argc,
char *argv[]) {
38 using namespace kaldi;
43 "Adds self-loops to states of an FST to propagate disambiguation symbols through it\n" 44 "They are added on each final state and each state with non-epsilon output symbols\n" 45 "on at least one arc out of the state. Useful in conjunction with predeterminize\n" 47 "Usage: fstaddselfloops in-disambig-list out-disambig-list [in.fst [out.fst] ]\n" 48 "E.g: fstaddselfloops in.list out.list < in.fst > withloops.fst\n" 49 "in.list and out.list are lists of integers, one per line, of the\n" 60 std::string disambig_in_rxfilename = po.
GetArg(1),
61 disambig_out_rxfilename = po.
GetArg(2),
67 std::vector<int32> disambig_in;
69 KALDI_ERR <<
"fstaddselfloops: Could not read disambiguation symbols from " 72 std::vector<int32> disambig_out;
74 KALDI_ERR <<
"fstaddselfloops: Could not read disambiguation symbols from " 77 if (disambig_in.size() != disambig_out.size())
78 KALDI_ERR <<
"fstaddselfloops: mismatch in size of disambiguation symbols";
87 }
catch(
const std::exception &e) {
88 std::cerr << e.what();
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
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 AddSelfLoops(const TransitionModel &trans_model, const std::vector< int32 > &disambig_syms, BaseFloat self_loop_scale, bool reorder, bool check_no_self_loops, fst::VectorFst< fst::StdArc > *fst)
For context, see AddSelfLoops().
int main(int argc, char *argv[])
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.
std::string GetArg(int param) const
Returns one of the positional parameters; 1-based indexing for argc/argv compatibility.
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)
std::string PrintableRxfilename(const std::string &rxfilename)
PrintableRxfilename turns the rxfilename into a more human-readable form for error reporting...
bool ReadIntegerVectorSimple(const std::string &rxfilename, std::vector< int32 > *list)
ReadFromList attempts to read this list of integers, one per line, from the given file...
std::string GetOptArg(int param) const