Go to the source code of this file.
|
int | main (int argc, char *argv[]) |
|
◆ main()
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Definition at line 26 of file copy-gselect.cc.
References SequentialTableReader< Holder >::Done(), ParseOptions::GetArg(), rnnlm::i, KALDI_ASSERT, KALDI_LOG, SequentialTableReader< Holder >::Key(), SequentialTableReader< Holder >::Next(), ParseOptions::NumArgs(), ParseOptions::PrintUsage(), ParseOptions::Read(), ParseOptions::Register(), SequentialTableReader< Holder >::Value(), and TableWriter< Holder >::Write().
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");
43 if (po.NumArgs() != 2) {
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...
A templated class for writing objects to an archive or script file; see The Table concept...
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...
#define KALDI_ASSERT(cond)