29       int32 src_r = r - shift;
    30       if (src_r < 0) src_r = 0;
    32       rearranged->
Row(r).CopyFromVec(src.
Row(src_r));
    37 int main(
int argc, 
char *argv[]) {
    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)");
    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...
 
int main(int argc, char *argv[])
 
void ShiftFeatureMatrix(const Matrix< BaseFloat > &src, int32 shift, Matrix< BaseFloat > *rearranged)
 
MatrixIndexT NumCols() const
Returns number of columns (or zero for empty matrix). 
 
void PrintUsage(bool print_command_line=false)
Prints the usage documentation [provided in the constructor]. 
 
A templated class for writing objects to an archive or script file; see The Table concept...
 
void Register(const std::string &name, bool *ptr, const std::string &doc)
 
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...
 
const SubVector< Real > Row(MatrixIndexT i) const
Return specific row of matrix [const]. 
 
A templated class for reading objects sequentially from an archive or script file; see The Table conc...
 
int Read(int argc, const char *const *argv)
Parses the command line options and fills the ParseOptions-registered variables. 
 
std::string GetArg(int param) const
Returns one of the positional parameters; 1-based indexing for argc/argv compatibility. 
 
int NumArgs() const
Number of positional parameters (c.f. argc-1). 
 
MatrixIndexT NumRows() const
Returns number of rows (or zero for empty matrix). 
 
void WriteKaldiObject(const C &c, const std::string &filename, bool binary)