38     using namespace kaldi;
    42         "Read in a Table containing N-best entries from a lattices (i.e. individual\n"    43         "lattices with a linear structure, one for each N-best entry, indexed by\n"    44         "utt_id_a-1, utt_id_a-2, etc., and take the union of them for each utterance\n"    45         "id (e.g. utt_id_a), outputting a lattice for each.\n"    46         "Usage:  nbest-to-lattice <nbest-rspecifier> <lattices-wspecifier>\n"    47         " e.g.: nbest-to-lattice ark:1.nbest ark:1.lats\n";
    53     if (po.NumArgs() != 2) {
    58     std::string nbest_rspecifier = po.GetArg(1),
    59         lats_wspecifier = po.GetArg(2);
    65     int32 n_nbest_done = 0, n_utt_done = 0;
    70     std::string cur_utt_id;
    72     for (; !compact_nbest_reader.Done(); compact_nbest_reader.Next()) {
    73       std::string nbest_id = compact_nbest_reader.Key();
    77         KALDI_ERR << 
"Invalid n-best id " << nbest_id << 
": make sure you "    78             "are giving N-bests to nbest-to-lattice.";
    80       if (utt_id != cur_utt_id) { 
    81         if (cur_utt_id != 
"") {
    82           compact_lattice_writer.Write(cur_utt_id, cur_union);
    83           cur_union.DeleteStates();
    89       Union(&cur_union, this_nbest);
    94       compact_lattice_writer.Write(cur_utt_id, cur_union);
    96     KALDI_LOG << 
"Done joining n-best into lattices for "    97               << n_utt_done << 
" utterances, with on average "    98               << (n_nbest_done/
static_cast<BaseFloat>(n_utt_done))
    99               << 
" N-best paths per utterance.";
   100     return (n_utt_done != 0 ? 0 : 1);
   101   } 
catch(
const std::exception &e) {
   102     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...
 
fst::VectorFst< CompactLatticeArc > CompactLattice
 
bool GetUtteranceId(const std::string &nbest_id, std::string *utterance_id)