copy-tree.cc File Reference
Include dependency graph for copy-tree.cc:

Go to the source code of this file.

Functions

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

Function Documentation

◆ main()

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

Definition at line 28 of file copy-tree.cc.

References ParseOptions::GetArg(), KALDI_LOG, ParseOptions::NumArgs(), ParseOptions::PrintUsage(), ParseOptions::Read(), kaldi::ReadKaldiObject(), ParseOptions::Register(), and kaldi::WriteKaldiObject().

28  {
29  using namespace kaldi;
30  try {
31  using namespace kaldi;
32  typedef kaldi::int32 int32;
33 
34  const char *usage =
35  "Copy decision tree (possibly changing binary/text format)\n"
36  "Usage: copy-tree [--binary=false] <tree-in> <tree-out>\n";
37 
38  bool binary = true;
39  ParseOptions po(usage);
40  po.Register("binary", &binary, "Write output in binary mode");
41 
42  po.Read(argc, argv);
43 
44  if (po.NumArgs() != 2) {
45  po.PrintUsage();
46  exit(1);
47  }
48 
49  std::string tree_in_filename = po.GetArg(1),
50  tree_out_filename = po.GetArg(2);
51 
52  ContextDependency ctx_dep;
53  ReadKaldiObject(tree_in_filename, &ctx_dep);
54  WriteKaldiObject(ctx_dep, tree_out_filename, binary);
55  KALDI_LOG << "Copied tree";
56  } catch(const std::exception &e) {
57  std::cerr << e.what();
58  return -1;
59  }
60 }
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
Definition: chain.dox:20
kaldi::int32 int32
void ReadKaldiObject(const std::string &filename, Matrix< float > *m)
Definition: kaldi-io.cc:832
The class ParseOptions is for parsing command-line options; see Parsing command-line options for more...
Definition: parse-options.h:36
void WriteKaldiObject(const C &c, const std::string &filename, bool binary)
Definition: kaldi-io.h:257
#define KALDI_LOG
Definition: kaldi-error.h:153