25 int main(
int argc,
char *argv[]) {
27 using namespace kaldi;
30 "Reads an archive of features and writes a corresponding archive\n" 31 "that maps utterance-id to utterance length in frames, or (with\n" 32 "one argument) print to stdout the total number of frames in the\n" 34 "Usage: feat-to-len [options] <in-rspecifier> [<out-wspecifier>]\n" 35 "e.g.: feat-to-len scp:feats.scp ark,t:feats.lengths\n" 36 "or: feat-to-len scp:feats.scp\n";
48 std::string rspecifier = po.
GetArg(1);
49 std::string wspecifier = po.
GetArg(2);
54 for (; !matrix_reader.
Done(); matrix_reader.
Next())
55 length_writer.
Write(matrix_reader.
Key(), matrix_reader.
Value().NumRows());
58 std::string rspecifier = po.
GetArg(1);
60 for (; !matrix_reader.
Done(); matrix_reader.
Next())
61 tot += matrix_reader.
Value().NumRows();
62 std::cout << tot << std::endl;
65 }
catch(
const std::exception &e) {
66 std::cerr << e.what();
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
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 Write(const std::string &key, const T &value) const
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...
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).
int main(int argc, char *argv[])