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";
44 if (po.NumArgs() < 2 || po.NumArgs() > 3) {
49 std::string phones_symtab_filename = po.GetArg(1),
50 transition_model_filename = po.GetArg(2),
51 accumulator_filename = po.GetOptArg(3);
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);
69 occs.
Read(ki.Stream(), 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 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...
void Read(std::istream &in, bool binary, bool add=false)
Read function using C++ streams.