36     using namespace kaldi;
    38     using fst::SymbolTable;
    43         "Generate lattices, reading log-likelihoods as matrices, using multiple decoding threads\n"    44         " (model is needed only for the integer mappings in its transition-model)\n"    45         "Usage: latgen-faster-mapped-parallel [options] trans-model-in (fst-in|fsts-rspecifier) loglikes-rspecifier"    46         " lattice-wspecifier [ words-wspecifier [alignments-wspecifier] ]\n";
    49     bool allow_partial = 
false;
    54     std::string word_syms_filename;
    58     po.Register(
"acoustic-scale", &acoustic_scale, 
"Scaling factor for acoustic likelihoods");
    60     po.Register(
"word-symbol-table", &word_syms_filename, 
"Symbol table for words [for debug output]");
    61     po.Register(
"allow-partial", &allow_partial, 
"If true, produce output even if end state was not reached.");
    65     if (po.NumArgs() < 4 || po.NumArgs() > 6) {
    70     std::string model_in_filename = po.GetArg(1),
    71         fst_in_str = po.GetArg(2),
    72         feature_rspecifier = po.GetArg(3),
    73         lattice_wspecifier = po.GetArg(4),
    74         words_wspecifier = po.GetOptArg(5),
    75         alignment_wspecifier = po.GetOptArg(6);
    83     if (! (determinize ? compact_lattice_writer.
Open(lattice_wspecifier)
    84            : lattice_writer.
Open(lattice_wspecifier)))
    85       KALDI_ERR << 
"Could not open table for writing lattices: "    86                  << lattice_wspecifier;
    92     fst::SymbolTable *word_syms = NULL;
    93     if (word_syms_filename != 
"")
    94       if (!(word_syms = fst::SymbolTable::ReadText(word_syms_filename)))
    95         KALDI_ERR << 
"Could not read symbol table from file "    96                    << word_syms_filename;
    98     double tot_like = 0.0;
    99     kaldi::int64 frame_count = 0;
   100     int num_success = 0, num_fail = 0;
   101     Fst<StdArc> *decode_fst = NULL; 
   111         for (; !loglike_reader.Done(); loglike_reader.Next()) {
   112           std::string utt = loglike_reader.Key();
   115           loglike_reader.FreeCurrent();
   116           if (loglikes->
NumRows() == 0) {
   117             KALDI_WARN << 
"Zero-length utterance: " << utt;
   129                   decoder, decodable, trans_model, word_syms, utt,
   130                   acoustic_scale, determinize, allow_partial, &alignment_writer,
   131                   &words_writer, &compact_lattice_writer, &lattice_writer,
   132                   &tot_like, &frame_count, &num_success, &num_fail, NULL);
   141       for (; !fst_reader.Done(); fst_reader.Next()) {
   142         std::string utt = fst_reader.Key();
   143         if (!loglike_reader.HasKey(utt)) {
   144           KALDI_WARN << 
"Not decoding utterance " << utt
   145                      << 
" because no loglikes available.";
   151         if (loglikes->
NumRows() == 0) {
   152           KALDI_WARN << 
"Zero-length utterance: " << utt;
   157         fst::VectorFst<StdArc> *
fst = 
   158           new fst::VectorFst<StdArc>(fst_reader.Value());
   165                 decoder, decodable, trans_model, word_syms, utt, acoustic_scale,
   166                 determinize, allow_partial, &alignment_writer, &words_writer,
   167                 &compact_lattice_writer, &lattice_writer, &tot_like,
   168                 &frame_count, &num_success, &num_fail, NULL);
   177     double elapsed = timer.
Elapsed();
   180               << 
"s: real-time factor per thread assuming 100 frames/sec is "   181               << (sequencer_config.
num_threads*elapsed*100.0/frame_count);
   182     KALDI_LOG << 
"Done " << num_success << 
" utterances, failed for "   184     KALDI_LOG << 
"Overall log-likelihood per frame is " << (tot_like/frame_count) << 
" over "   185               << frame_count<<
" frames.";
   188     if (num_success != 0) 
return 0;
   190   } 
catch(
const std::exception &e) {
   191     std::cerr << e.what();
 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)
 
For an extended explanation of the framework of which grammar-fsts are a part, please see Support for...
 
A templated class for writing objects to an archive or script file; see The Table concept...
 
RspecifierType ClassifyRspecifier(const std::string &rspecifier, std::string *rxfilename, RspecifierOptions *opts)
 
void ReadKaldiObject(const std::string &filename, Matrix< float > *m)
 
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...
 
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)