27     using namespace kaldi;
    30     typedef kaldi::int64 int64;
    33         "Creates a random subset of the input examples, of a specified size.\n"    34         "Uses no more memory than the size of the subset.\n"    36         "Usage:  nnet3-discriminative-subset-egs [options] <degs-rspecifier> [<degs-wspecifier2> ...]\n"    39         "nnet3-discriminative-copy-egs [args] ark:degs.1.ark ark:- | nnet-discriminative-subset-egs --n=1000 ark:- ark:subset.egs\n";
    43     bool randomize_order = 
true;
    45     po.Register(
"srand", &srand_seed, 
"Seed for random number generator ");
    46     po.Register(
"n", &n, 
"Number of examples to output");
    47     po.Register(
"randomize-order", &randomize_order, 
"If true, randomize the order "    54     if (po.NumArgs() != 2) {
    59     std::string examples_rspecifier = po.GetArg(1),
    60         examples_wspecifier = po.GetArg(2);
    62     std::vector<std::pair<std::string, NnetDiscriminativeExample> > egs;
    68     for (; !example_reader.Done(); example_reader.Next()) {
    71         egs.resize(egs.size() + 1);
    72         egs.back().first = example_reader.Key();
    73         egs.back().second = example_reader.Value();
    78           egs[index].first = example_reader.Key();
    79           egs[index].second = example_reader.Value();
    84       std::random_shuffle(egs.begin(), egs.end());
    87     for (
size_t i = 0; 
i < egs.size(); 
i++) {
    88       writer.Write(egs[
i].first, egs[
i].second);
    91     KALDI_LOG << 
"Selected a subset of " << egs.size() << 
" out of " << num_read
    92               << 
" neural-network discriminative training examples ";
    94     return (num_read != 0 ? 0 : 1);
    95   } 
catch(
const std::exception &e) {
    96     std::cerr << e.what() << 
'\n';
 This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
 
bool WithProb(BaseFloat prob, struct RandomState *state)
 
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...
 
int32 RandInt(int32 min_val, int32 max_val, struct RandomState *state)