26 int main(
int argc,
char *argv[]) {
28 using namespace kaldi;
32 "Copy Gaussian indices for pruning, possibly making the\n" 33 "lists shorter (e.g. the --n=10 limits to the 10 best indices\n" 34 "See also gmm-gselect, fgmm-gselect\n" 35 "Usage: copy-gselect [options] <gselect-rspecifier> <gselect-wspecifier>\n";
38 int32 num_gselect = 0;
39 std::string likelihood_wspecifier;
40 po.
Register(
"n", &num_gselect,
"Number of Gaussians to keep per frame (if nonzero)\n");
49 std::string gselect_rspecifier = po.
GetArg(1),
50 gselect_wspecifier = po.
GetArg(2);
55 for (; !gselect_reader.
Done(); gselect_reader.
Next()) {
56 std::string utt = gselect_reader.
Key();
57 if (num_gselect == 0) {
58 gselect_writer.
Write(utt, gselect_reader.
Value());
60 vector<vector<int32> > gselect(gselect_reader.
Value());
61 for (
size_t i = 0;
i < gselect.size();
i++)
62 if (static_cast<int32>(gselect[
i].size()) > num_gselect)
63 gselect[
i].resize(num_gselect);
64 gselect_writer.
Write(utt, gselect);
69 KALDI_LOG <<
"Copied " << num_done <<
" gselect objects ";
71 KALDI_LOG <<
"Copied " << num_done <<
" gselect objects, " 72 <<
" limiting sizes to " << num_gselect;
73 if (num_done != 0)
return 0;
75 }
catch(
const std::exception &e) {
76 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
void Register(const std::string &name, bool *ptr, const std::string &doc)
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).
#define KALDI_ASSERT(cond)
int main(int argc, char *argv[])