ivector-extractor-copy.cc File Reference
Include dependency graph for ivector-extractor-copy.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 26 of file ivector-extractor-copy.cc.

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

26  {
27  try {
28  using namespace kaldi;
29  using kaldi::int32;
30 
31  const char *usage =
32  "Copy the i-vector extractor to a text file\n"
33  "Usage: ivector-extractor-copy [options] <ivector-extractor-in> <ivector-extractor-out>\n"
34  "e.g.:\n"
35  " ivector-extractor-copy --binary=false 0.ie 0_txt.ie\n";
36 
37  bool binary = true;
38  IvectorExtractorOptions ivector_opts;
39  ParseOptions po(usage);
40  po.Register("binary", &binary, "Write output in binary mode");
41  ivector_opts.Register(&po);
42 
43  po.Read(argc, argv);
44 
45  if (po.NumArgs() != 2) {
46  po.PrintUsage();
47  exit(1);
48  }
49 
50  std::string ivector_extractor_rxfilename = po.GetArg(1),
51  ivector_extractor_wxfilename = po.GetArg(2);
52 
53  IvectorExtractor extractor;
54  ReadKaldiObject(ivector_extractor_rxfilename, &extractor);
55 
56  WriteKaldiObject(extractor, ivector_extractor_wxfilename, binary);
57 
58  return 0;
59  } catch(const std::exception &e) {
60  std::cerr << e.what();
61  return -1;
62  }
63 }
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 Register(OptionsItf *opts)
void WriteKaldiObject(const C &c, const std::string &filename, bool binary)
Definition: kaldi-io.h:257