25 int main(
int argc,
char *argv[]) {
27 using namespace kaldi;
30 "Reads an archive of features. If second argument is wxfilename, writes\n" 31 "the feature dimension of the first feature file; if second argument is\n" 32 "wspecifier, writes an archive of the feature dimension, indexed by utterance\n" 34 "Usage: feat-to-dim [options] <feat-rspecifier> (<dim-wspecifier>|<dim-wxfilename>)\n" 35 "e.g.: feat-to-dim scp:feats.scp -\n";
46 std::string rspecifier = po.
GetArg(1);
47 std::string wspecifier_or_wxfilename = po.
GetArg(2);
54 for (; !kaldi_reader.
Done(); kaldi_reader.
Next())
55 dim_writer.
Write(kaldi_reader.
Key(), kaldi_reader.
Value().NumCols());
57 if (kaldi_reader.
Done())
58 KALDI_ERR <<
"Could not read any features (empty archive?)";
59 Output ko(wspecifier_or_wxfilename,
false);
60 ko.
Stream() << kaldi_reader.
Value().NumCols() <<
"\n";
63 }
catch(
const std::exception &e) {
64 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 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.
WspecifierType ClassifyWspecifier(const std::string &wspecifier, std::string *archive_wxfilename, std::string *script_wxfilename, WspecifierOptions *opts)
int NumArgs() const
Number of positional parameters (c.f. argc-1).