All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
hmm-info.cc File Reference
Include dependency graph for hmm-info.cc:

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 

Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 24 of file hmm-info.cc.

References ParseOptions::GetArg(), TransitionModel::GetPhones(), ParseOptions::NumArgs(), TransitionModel::NumPdfs(), TransitionModel::NumTransitionIds(), TransitionModel::NumTransitionStates(), ParseOptions::PrintUsage(), ParseOptions::Read(), TransitionModel::Read(), and Input::Stream().

24  {
25  try {
26  using namespace kaldi;
27  typedef kaldi::int32 int32;
28 
29  const char *usage =
30  "Write to standard output various properties of HMM-based transition model\n"
31  "Usage: hmm-info [options] <model-in>\n"
32  "e.g.:\n"
33  " hmm-info trans.mdl\n";
34 
35  ParseOptions po(usage);
36 
37  po.Read(argc, argv);
38 
39  if (po.NumArgs() != 1) {
40  po.PrintUsage();
41  exit(1);
42  }
43 
44  std::string model_in_filename = po.GetArg(1);
45 
46  TransitionModel trans_model;
47  {
48  bool binary_read;
49  Input ki(model_in_filename, &binary_read);
50  trans_model.Read(ki.Stream(), binary_read);
51  }
52 
53  std::cout << "number of phones " << trans_model.GetPhones().size() << '\n';
54  std::cout << "number of pdfs " << trans_model.NumPdfs() << '\n';
55  std::cout << "number of transition-ids " << trans_model.NumTransitionIds()
56  << '\n';
57  std::cout << "number of transition-states "
58  << trans_model.NumTransitionStates() << '\n';
59  } catch(const std::exception &e) {
60  std::cerr << e.what() << '\n';
61  return -1;
62  }
63 }
Relabels neural network egs with the read pdf-id alignments.
Definition: chain.dox:20
const std::vector< int32 > & GetPhones() const
Returns a sorted, unique list of phones.
int32 NumTransitionIds() const
Returns the total number of transition-ids (note, these are one-based).
The class ParseOptions is for parsing command-line options; see Parsing command-line options for more...
Definition: parse-options.h:36
void Read(std::istream &is, bool binary)
int32 NumTransitionStates() const
Returns the total number of transition-states (note, these are one-based).