39 using namespace kaldi;
42 "Copy features, and possibly shift them while maintaining the " 44 "Usage: shift-feats [options] <feature-rspecifier> " 45 "<feature-wspecifier>\n" 46 "or: shift-feats [options] <feats-rxfilename> <feats-wxfilename>\n" 47 "e.g.: shift-feats --shift=-1 foo.scp bar.ark\n" 48 "or: shift-feats --shift=1 foo.mat bar.mat\n" 49 "See also: copy-feats, copy-matrix, select-feats, subset-feats,\n" 50 "subsample-feats, splice-feats, paste-feats, concat-feats, " 51 "extract-feature-segments\n";
56 po.Register(
"shift", &shift,
"Number of frames by which to shift the " 58 po.Register(
"binary", &binary,
"Binary-mode output (not relevant if " 59 "writing to archive)");
63 if (po.NumArgs() != 2) {
68 int32 num_done = 0, num_err = 0;
75 for (; !feat_reader.Done(); feat_reader.Next()) {
76 const std::string &key = feat_reader.Key();
85 feat_writer.Write(key, rearranged);
89 KALDI_LOG <<
"Shifted " << num_done <<
" features by " 90 << shift <<
" frames; " << num_err <<
" with errors.";
91 return (num_done > 0 ? 0 : 1);
93 std::string feat_rxfilename = po.GetArg(1),
94 feat_wxfilename = po.GetArg(2);
104 }
catch(
const std::exception &e) {
105 std::cerr << e.what();
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
void ShiftFeatureMatrix(const Matrix< BaseFloat > &src, int32 shift, Matrix< BaseFloat > *rearranged)
MatrixIndexT NumCols() const
Returns number of columns (or zero for empty matrix).
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)
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...
MatrixIndexT NumRows() const
Returns number of rows (or zero for empty matrix).
void WriteKaldiObject(const C &c, const std::string &filename, bool binary)