31     using namespace kaldi;
    33     typedef kaldi::int64 int64;
    38         "Compute best path through lattices and write out as FSTs\n"    39         "Note: differs from lattice-nbest with --n=1 because we won't\n"    40         "append -1 to the utterance-ids.  Differs from lattice-best-path\n"    41         "because output is FST.\n"    43         "Usage: lattice-1best [options] <lattice-rspecifier> <lattice-wspecifier>\n"    44         " e.g.: lattice-1best --acoustic-scale=0.1 ark:1.lats ark:1best.lats\n";
    51     po.Register(
"acoustic-scale", &acoustic_scale,
    52                 "Scaling factor for acoustic likelihoods");
    53     po.Register(
"lm-scale", &lm_scale,
    54                 "Scaling factor for language model scores.");
    55     po.Register(
"word-ins-penalty", &word_ins_penalty,
    56                 "Word insertion penality.");
    60     if (po.NumArgs() != 2) {
    65     std::string lats_rspecifier = po.GetArg(1),
    66         lats_wspecifier = po.GetArg(2);
    73     int32 n_done = 0, n_err = 0;
    75     if (acoustic_scale == 0.0 || lm_scale == 0.0)
    76       KALDI_ERR << 
"Do not use exactly zero acoustic or LM scale (cannot be inverted)";
    77     for (; !clat_reader.Done(); clat_reader.Next()) {
    78       std::string key = clat_reader.Key();
    80       clat_reader.FreeCurrent();
    82       if (word_ins_penalty > 0.0) {
    89       if (best_path.Start() == fst::kNoStateId) {
    90         KALDI_WARN << 
"Possibly empty lattice for utterance-id " << key
    94         if (word_ins_penalty > 0.0) {
    99         compact_1best_writer.Write(key, best_path);
   103     KALDI_LOG << 
"Done converting " << n_done << 
" to best path, "   104               << n_err << 
" had errors.";
   105     return (n_done != 0 ? 0 : 1);
   106   } 
catch(
const std::exception &e) {
   107     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...
 
void CompactLatticeShortestPath(const CompactLattice &clat, CompactLattice *shortest_path)
A form of the shortest-path/best-path algorithm that's specially coded for CompactLattice. 
 
The class ParseOptions is for parsing command-line options; see Parsing command-line options for more...
 
void ScaleLattice(const std::vector< std::vector< ScaleFloat > > &scale, MutableFst< ArcTpl< Weight > > *fst)
Scales the pairs of weights in LatticeWeight or CompactLatticeWeight by viewing the pair (a...
 
A templated class for reading objects sequentially from an archive or script file; see The Table conc...
 
std::vector< std::vector< double > > LatticeScale(double lmwt, double acwt)
 
void AddWordInsPenToCompactLattice(BaseFloat word_ins_penalty, CompactLattice *clat)
This function add the word insertion penalty to graph score of each word in the compact lattice...
 
fst::VectorFst< CompactLatticeArc > CompactLattice