22 #include "fst/fstlib.h" 26 int main(
int argc,
char *argv[]) {
28 using namespace kaldi;
30 using fst::SymbolTable;
35 "Print debugging info from transition model, in human-readable form\n" 36 "Usage: show-transitions <phones-symbol-table> <transition/model-file> [<occs-file>]\n" 38 " show-transitions phones.txt 1.mdl 1.occs\n";
49 std::string phones_symtab_filename = po.
GetArg(1),
50 transition_model_filename = po.
GetArg(2),
54 fst::SymbolTable *syms = fst::SymbolTable::ReadText(phones_symtab_filename);
56 KALDI_ERR <<
"Could not read symbol table from file " 57 << phones_symtab_filename;
58 std::vector<std::string> names(syms->NumSymbols());
59 for (
size_t i = 0;
i < syms->NumSymbols();
i++)
60 names[
i] = syms->Find(
i);
66 if (accumulator_filename !=
"") {
68 Input ki(accumulator_filename, &binary_in);
72 trans_model.
Print(std::cout,
74 (accumulator_filename !=
"" ? &occs : NULL));
77 }
catch(
const std::exception &e) {
78 std::cerr << e.what();
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
void PrintUsage(bool print_command_line=false)
Prints the usage documentation [provided in the constructor].
void ReadKaldiObject(const std::string &filename, Matrix< float > *m)
void Print(std::ostream &os, const std::vector< std::string > &phone_names, const Vector< double > *occs=NULL)
Print will print the transition model in a human-readable way, for purposes of human inspection...
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).
int main(int argc, char *argv[])
void Read(std::istream &in, bool binary, bool add=false)
Read function using C++ streams.
std::string GetOptArg(int param) const