35     using namespace kaldi;
    38     using fst::SymbolTable;
    43         "Generate lattices using neural net model.\n"    44         "Usage: nnet-latgen-faster-parallel [options] <nnet-in> <fst-in|fsts-rspecifier> <features-rspecifier>"    45         " <lattice-wspecifier> [ <words-wspecifier> [<alignments-wspecifier>] ]\n";
    48     bool allow_partial = 
false;
    53     std::string word_syms_filename;
    56     po.Register(
"acoustic-scale", &acoustic_scale, 
"Scaling factor for acoustic likelihoods");
    57     po.Register(
"word-symbol-table", &word_syms_filename, 
"Symbol table for words [for debug output]");
    58     po.Register(
"allow-partial", &allow_partial, 
"If true, produce output even if end state was not reached.");
    62     if (po.NumArgs() < 4 || po.NumArgs() > 6) {
    67     std::string model_in_filename = po.GetArg(1),
    68         fst_in_str = po.GetArg(2),
    69         feature_rspecifier = po.GetArg(3),
    70         lattice_wspecifier = po.GetArg(4),
    71         words_wspecifier = po.GetOptArg(5),
    72         alignment_wspecifier = po.GetOptArg(6);
    78       Input ki(model_in_filename, &binary);
    79       trans_model.
Read(ki.Stream(), binary);
    80       am_nnet.
Read(ki.Stream(), binary);
    86     if (! (determinize ? compact_lattice_writer.
Open(lattice_wspecifier)
    87            : lattice_writer.
Open(lattice_wspecifier)))
    88       KALDI_ERR << 
"Could not open table for writing lattices: "    89                  << lattice_wspecifier;
    97     fst::SymbolTable *word_syms = NULL;
    98     if (word_syms_filename != 
"")
    99       if (!(word_syms = fst::SymbolTable::ReadText(word_syms_filename)))
   100         KALDI_ERR << 
"Could not read symbol table from file "   101                    << word_syms_filename;
   106     double tot_like = 0.0;
   107     kaldi::int64 frame_count = 0;
   108     int num_done = 0, num_err = 0;
   109     Fst<StdArc> *decode_fst = NULL;
   118         for (; !feature_reader.Done(); feature_reader.Next()) {
   119           std::string utt = feature_reader.Key();
   121           if (features.NumRows() == 0) {
   122             KALDI_WARN << 
"Zero-length utterance: " << utt;
   126           bool pad_input = 
true;
   128               trans_model, am_nnet,
   130               pad_input, acoustic_scale);
   137                   decoder, nnet_decodable, 
   138                   trans_model, word_syms, utt, acoustic_scale, determinize,
   139                   allow_partial, &alignment_writer, &words_writer,
   140                   &compact_lattice_writer, &lattice_writer,
   141                   &tot_like, &frame_count, &num_done, &num_err, NULL);
   150       for (; !fst_reader.Done(); fst_reader.Next()) {
   151         std::string utt = fst_reader.Key();
   152         if (!feature_reader.HasKey(utt)) {
   153           KALDI_WARN << 
"Not decoding utterance " << utt
   154                      << 
" because no features available.";
   160           KALDI_WARN << 
"Zero-length utterance: " << utt;
   169         bool pad_input = 
true;
   171             trans_model, am_nnet,
   173             pad_input, acoustic_scale);
   177                 decoder, nnet_decodable, 
   178                 trans_model, word_syms, utt, acoustic_scale, determinize,
   179                 allow_partial, &alignment_writer, &words_writer,
   180                 &compact_lattice_writer, &lattice_writer,
   181                 &tot_like, &frame_count, &num_done, &num_err, NULL);
   190     double elapsed = timer.
Elapsed();
   192               << 
"s: real-time factor per thread assuming 100 frames/sec is "   193               << (sequencer_config.
num_threads * elapsed * 100.0 / frame_count);
   194     KALDI_LOG << 
"Done " << num_done << 
" utterances, failed for "   196     KALDI_LOG << 
"Overall log-likelihood per frame is "   197               << (tot_like / frame_count) << 
" over " << frame_count
   201     if (num_done != 0) 
return 0;
   203   } 
catch(
const std::exception &e) {
   204     std::cerr << e.what();
 This version of DecodableAmNnet is intended for a version of the decoder that processes different utt...
 
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
 
bool Open(const std::string &wspecifier)
 
Fst< StdArc > * ReadFstKaldiGeneric(std::string rxfilename, bool throw_on_err)
 
void Read(std::istream &is, bool binary)
 
A templated class for writing objects to an archive or script file; see The Table concept...
 
This class represents a matrix that's stored on the GPU if we have one, and in memory if not...
 
RspecifierType ClassifyRspecifier(const std::string &rspecifier, std::string *rxfilename, RspecifierOptions *opts)
 
Allows random access to a collection of objects in an archive or script file; see The Table concept...
 
This class basically does the same job as the function DecodeUtteranceLatticeFaster, but in a way that allows us to build a multi-threaded command line program more easily. 
 
The class ParseOptions is for parsing command-line options; see Parsing command-line options for more...
 
void Read(std::istream &is, bool binary)
 
A templated class for reading objects sequentially from an archive or script file; see The Table conc...
 
This is the "normal" lattice-generating decoder. 
 
MatrixIndexT NumRows() const
Returns number of rows (or zero for empty matrix). 
 
LatticeFasterDecoderTpl< fst::StdFst, decoder::StdToken > LatticeFasterDecoder
 
void Register(OptionsItf *opts)
 
double Elapsed() const
Returns time in seconds. 
 
void Register(OptionsItf *opts)