22 #include "fst/fstlib.h" 25 int main(
int argc,
char *argv[]) {
27 using namespace kaldi;
29 using fst::SymbolTable;
34 "Make transducer from pdfs to transition-ids\n" 35 "Usage: make-pdf-to-tid-transducer model-filename [fst-out]\n" 37 " make-pdf-to-tid-transducer 1.mdl > pdf2tid.fst\n";
47 std::string trans_model_filename = po.
GetArg(1);
48 std::string fst_out_filename = po.
GetOptArg(2);
56 if (fst_out_filename ==
"")
57 _setmode(_fileno(stdout), _O_BINARY);
60 if (!fst->Write(fst_out_filename))
62 << (fst_out_filename ==
"" ?
"standard output" : fst_out_filename);
64 }
catch(
const std::exception &e) {
65 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].
int main(int argc, char *argv[])
void ReadKaldiObject(const std::string &filename, Matrix< float > *m)
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).
std::string GetOptArg(int param) const
fst::VectorFst< fst::StdArc > * GetPdfToTransitionIdTransducer(const TransitionModel &trans_model)
Returns a transducer from pdfs plus one (input) to transition-ids (output).