26 int main(
int argc, 
char *argv[]) {
    28     using namespace kaldi;
    30     typedef kaldi::int64 int64;
    31     using fst::SymbolTable;
    36         "Takes as input lattices/n-bests which must be linear (single path);\n"    37         "convert from lattice to up to 4 archives containing transcriptions, alignments,\n"    38         "and acoustic and LM costs (note: use ark:/dev/null for unwanted outputs)\n"    39         "Usage: nbest-to-linear [options] <nbest-rspecifier> <alignments-wspecifier> "    40         "[<transcriptions-wspecifier> [<lm-cost-wspecifier> [<ac-cost-wspecifier>]]]\n"    41         " e.g.: lattice-to-nbest --n=10 ark:1.lats ark:- | \\\n"    42         "   nbest-to-linear ark:1.lats ark,t:1.ali 'ark,t:|int2sym.pl -f 2- words.txt > text'\n";
    53     std::string lats_rspecifier = po.
GetArg(1),
    54         ali_wspecifier = po.
GetArg(2),
    66     int32 n_done = 0, n_err = 0;
    68     for (; !lattice_reader.
Done(); lattice_reader.
Next()) {
    69       std::string key = lattice_reader.
Key();
    72       std::vector<int32> ilabels;
    73       std::vector<int32> olabels;
    77         KALDI_WARN << 
"Lattice/nbest for key " << key << 
" had wrong format: "    78             "note, this program expects input with one path, e.g. from "    82         if (ali_wspecifier != 
"") ali_writer.
Write(key, ilabels);
    83         if (trans_wspecifier != 
"") trans_writer.
Write(key, olabels);
    84         if (lm_cost_wspecifier != 
"") lm_cost_writer.
Write(key, weight.
Value1());
    85         if (ac_cost_wspecifier!= 
"") ac_cost_writer.
Write(key, weight.
Value2());
    89     KALDI_LOG << 
"Done " << n_done << 
" n-best entries, "    90               << n_err  << 
" had errors.";
    91     return (n_done != 0 ? 0 : 1);
    92   } 
catch(
const std::exception &e) {
    93     std::cerr << e.what();
 
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
 
int main(int argc, char *argv[])
 
void PrintUsage(bool print_command_line=false)
Prints the usage documentation [provided in the constructor]. 
 
A templated class for writing objects to an archive or script file; see The Table concept...
 
bool GetLinearSymbolSequence(const Fst< Arc > &fst, std::vector< I > *isymbols_out, std::vector< I > *osymbols_out, typename Arc::Weight *tot_weight_out)
GetLinearSymbolSequence gets the symbol sequence from a linear FST. 
 
void Write(const std::string &key, const T &value) const
 
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< LatticeArc > Lattice
 
int Read(int argc, const char *const *argv)
Parses the command line options and fills the ParseOptions-registered variables. 
 
std::string GetArg(int param) const
Returns one of the positional parameters; 1-based indexing for argc/argv compatibility. 
 
int NumArgs() const
Number of positional parameters (c.f. argc-1). 
 
std::string GetOptArg(int param) const