72     using namespace kaldi;
    76         "Paste feature files (assuming they have about the same durations,\n"    77         "see --length-tolerance), appending the features on each frame;\n"    78         "think of the unix command 'paste'.\n"    79         "Usage: paste-feats <in-rspecifier1> <in-rspecifier2> [<in-rspecifier3> ...] <out-wspecifier>\n"    80         " or: paste-feats <in-rxfilename1> <in-rxfilename2> [<in-rxfilename3> ...] <out-wxfilename>\n"    81         " e.g. paste-feats ark:feats1.ark \"ark:select-feats 0-3 ark:feats2.ark ark:- |\" ark:feats-out.ark\n"    82         "  or: paste-feats foo.mat bar.mat baz.mat\n"    83         "See also: copy-feats, copy-matrix, append-vector-to-feats, concat-feats\n";
    87     int32 length_tolerance = 0;
    89     po.Register(
"length-tolerance", &length_tolerance,
    90                 "If length is different, trim as shortest up to a frame "    91                 " difference of length-tolerance, otherwise exclude segment.");
    92     po.Register(
"binary", &binary, 
"If true, output files in binary "    93                 "(only relevant for single-file operation, i.e. no tables)");
    97     if (po.NumArgs() < 3) {
   107       string wspecifier = po.GetArg(po.NumArgs());
   111       string rspecifier1 = po.GetArg(1);
   115       vector<RandomAccessBaseFloatMatrixReader *> input;
   116       for (
int32 i = 2; 
i < po.NumArgs(); 
i++) {
   117         string rspecifier = po.GetArg(
i);
   122       int32 num_done = 0, num_err = 0;
   125       for (; !input1.Done(); input1.Next()) {
   126         string utt = input1.Key();
   127         KALDI_VLOG(2) << 
"Merging features for utterance " << utt;
   130         vector<Matrix<BaseFloat> > feats(po.NumArgs() - 1);
   131         feats[0] = input1.Value();
   133         for (i = 0; i < static_cast<int32>(input.size()); i++) {
   134           if (input[i]->HasKey(utt)) {
   135             feats[i + 1] = input[
i]->Value(utt);
   137             KALDI_WARN << 
"Missing utt " << utt << 
" from input "   143         if (i != static_cast<int32>(input.size()))
   146         if (!
AppendFeats(feats, utt, length_tolerance, &output)) {
   150         feat_writer.
Write(utt, output);
   154       for (
int32 i=0; i < input.size(); i++)
   158       KALDI_LOG << 
"Done " << num_done << 
" utts, errors on "   161       return (num_done == 0 ? -1 : 0);
   164       std::vector<Matrix<BaseFloat> > feats(po.NumArgs() - 1);
   165       for (
int32 i = 1; i < po.NumArgs(); i++)
   168       if (!
AppendFeats(feats, 
"", length_tolerance, &output))
   170       std::string output_wxfilename = po.GetArg(po.NumArgs());
   172       KALDI_LOG << 
"Wrote appended features to " << output_wxfilename;
   175   } 
catch(
const std::exception &e) {
   176     std::cerr << e.what();
 This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
 
void Write(std::ostream &out, bool binary) const
write to stream. 
 
RandomAccessTableReader< KaldiObjectHolder< Matrix< BaseFloat > > > RandomAccessBaseFloatMatrixReader
 
A templated class for writing objects to an archive or script file; see The Table concept...
 
RspecifierType ClassifyRspecifier(const std::string &rspecifier, std::string *rxfilename, RspecifierOptions *opts)
 
void ReadKaldiObject(const std::string &filename, Matrix< float > *m)
 
Allows random access to a collection of objects in an archive or script file; see The Table concept...
 
bool AppendFeats(const std::vector< Matrix< BaseFloat > > &in, const std::string &utt, int32 tolerance, Matrix< BaseFloat > *out)
 
The class ParseOptions is for parsing command-line options; see Parsing command-line options for more...
 
A templated class for reading objects sequentially from an archive or script file; see The Table conc...
 
void WriteKaldiObject(const C &c, const std::string &filename, bool binary)