concat-feats.cc File Reference
Include dependency graph for concat-feats.cc:

Go to the source code of this file.

Namespaces

 kaldi
 This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for mispronunciations detection tasks, the reference:
 

Functions

void ConcatFeats (const std::vector< Matrix< BaseFloat > > &in, Matrix< BaseFloat > *out)
 
int main (int argc, char *argv[])
 

Function Documentation

◆ main()

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

Definition at line 57 of file concat-feats.cc.

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

57  {
58  try {
59  using namespace kaldi;
60  using namespace std;
61 
62  const char *usage =
63  "Concatenate feature files (assuming they have the same dimensions),\n"
64  "so the output file has the sum of the num-frames of the inputs.\n"
65  "Usage: concat-feats <in-rxfilename1> <in-rxfilename2> [<in-rxfilename3> ...] <out-wxfilename>\n"
66  " e.g. concat-feats mfcc/foo.ark:12343 mfcc/foo.ark:56789 -\n"
67  "See also: copy-feats, append-vector-to-feats, paste-feats\n";
68 
69  ParseOptions po(usage);
70 
71  bool binary = true;
72  po.Register("binary", &binary, "If true, output files in binary "
73  "(only relevant for single-file operation, i.e. no tables)");
74 
75  po.Read(argc, argv);
76 
77  if (po.NumArgs() < 3) {
78  po.PrintUsage();
79  exit(1);
80  }
81 
82  std::vector<Matrix<BaseFloat> > feats(po.NumArgs() - 1);
83  for (int32 i = 1; i < po.NumArgs(); i++)
84  ReadKaldiObject(po.GetArg(i), &(feats[i-1]));
85  Matrix<BaseFloat> output;
86  ConcatFeats(feats, &output);
87  std::string output_wxfilename = po.GetArg(po.NumArgs());
88  WriteKaldiObject(output, output_wxfilename, binary);
89 
90  // This will tend to produce too much output if we have a logging mesage.
91  // KALDI_LOG << "Wrote concatenated features to " << output_wxfilename;
92  return 0;
93  } catch(const std::exception &e) {
94  std::cerr << e.what();
95  return -1;
96  }
97 }
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
Definition: chain.dox:20
void ConcatFeats(const std::vector< Matrix< BaseFloat > > &in, Matrix< BaseFloat > *out)
Definition: concat-feats.cc:35
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