All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
fmpe-copy.cc File Reference
#include "base/kaldi-common.h"
#include "util/common-utils.h"
#include "transform/fmpe.h"
Include dependency graph for fmpe-copy.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 fmpe-copy.cc.

References ParseOptions::GetArg(), KALDI_LOG, ParseOptions::NumArgs(), ParseOptions::PrintUsage(), ParseOptions::Read(), kaldi::ReadKaldiObject(), ParseOptions::Register(), FmpeOptions::Register(), Output::Stream(), and Fmpe::Write().

24  {
25  using namespace kaldi;
26  try {
27  const char *usage =
28  "Copy fMPE transform\n"
29  "Usage: fmpe-copy [options...] <fmpe-in> <fmpe-out>\n"
30  "E.g. fmpe-copy --binary=false 1.fmpe text.fmpe\n";
31 
32  ParseOptions po(usage);
33  FmpeOptions opts;
34  bool binary = true;
35  po.Register("binary", &binary, "If true, output fMPE object in binary mode.");
36  opts.Register(&po);
37  po.Read(argc, argv);
38 
39  if (po.NumArgs() != 2) {
40  po.PrintUsage();
41  exit(1);
42  }
43 
44  std::string fmpe_rxfilename = po.GetArg(1),
45  fmpe_wxfilename = po.GetArg(2);
46 
47  Fmpe fmpe;
48  ReadKaldiObject(fmpe_rxfilename, &fmpe);
49 
50 
51  Output ko(fmpe_wxfilename, binary);
52  fmpe.Write(ko.Stream(), binary);
53 
54  KALDI_LOG << "Copyied fMPE object to " << fmpe_wxfilename;
55  return 0;
56  } catch(const std::exception &e) {
57  std::cerr << e.what();
58  return -1;
59  }
60 }
Relabels neural network egs with the read pdf-id alignments.
Definition: chain.dox:20
void ReadKaldiObject(const std::string &filename, Matrix< float > *m)
Definition: kaldi-io.cc:818
The class ParseOptions is for parsing command-line options; see Parsing command-line options for more...
Definition: parse-options.h:36
void Register(OptionsItf *opts)
Definition: fmpe.h:75
void Write(std::ostream &os, bool binary) const
Definition: fmpe.cc:500
#define KALDI_LOG
Definition: kaldi-error.h:133