26 int main(
int argc, 
char *argv[]) {
    28     using namespace kaldi;
    30     typedef kaldi::int64 int64;
    31     using fst::SymbolTable;
    36         "Takes two archives of lattices (indexed by utterances) and computes "    37         "the union of the individual lattice pairs (one from each archive).\n"    38         "Usage: lattice-union [options] lattice-rspecifier1 lattice-rspecifier2"    39         " lattice-wspecifier\n"    40         " e.g.: lattice-union ark:den.lats ark:num.lats ark:union.lats\n";
    50     std::string lats_rspecifier1 = po.
GetArg(1),
    51         lats_rspecifier2 = po.
GetArg(2),
    52         lats_wspecifier = po.
GetArg(3);
    59     int32 n_done = 0, n_union = 0, n_no_lat = 0;
    61     for (; !lattice_reader1.
Done(); lattice_reader1.
Next()) {
    62       std::string key = lattice_reader1.
Key();
    65       if (lattice_reader2.
HasKey(key)) {
    70         KALDI_WARN << 
"No lattice found for utterance " << key << 
" in "    71                    << lats_rspecifier2 << 
". Result of union will be the "    72                    << 
"lattice found in " << lats_rspecifier1;
    81       compact_lattice_writer.
Write(key, clat_out);
    85     KALDI_LOG << 
"Total " << n_done << 
"lattices written. Computed union for "    86               << n_union << 
" pairs of lattices. Missing second lattice in "    87               << n_no_lat << 
" cases.";
    88     KALDI_LOG << 
"Done " << n_done << 
" lattices.";
    89     return (n_done != 0 ? 0 : 1);
    90   } 
catch(
const std::exception &e) {
    91     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...
 
void Write(const std::string &key, const T &value) const
 
Allows random access to a collection of objects in 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...
 
const T & Value(const std::string &key)
 
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. 
 
bool HasKey(const std::string &key)
 
fst::VectorFst< CompactLatticeArc > CompactLattice
 
int NumArgs() const
Number of positional parameters (c.f. argc-1). 
 
bool DeterminizeLattice(const Fst< ArcTpl< Weight > > &ifst, MutableFst< ArcTpl< Weight > > *ofst, DeterminizeLatticeOptions opts, bool *debug_ptr)
This function implements the normal version of DeterminizeLattice, in which the output strings are re...