27 int main(
int argc, 
char *argv[]) {
    29     using namespace kaldi;
    31     typedef kaldi::int64 int64;
    32     using fst::SymbolTable;
    37         "Apply scaling to lattice weights\n"    38         "Usage: lattice-scale [options] lattice-rspecifier lattice-wspecifier\n"    39         " e.g.: lattice-scale --lm-scale=0.0 ark:1.lats ark:scaled.lats\n";
    42     bool write_compact = 
true;
    49     po.
Register(
"write-compact", &write_compact, 
"If true, write in normal (compact) form.");
    50     po.
Register(
"acoustic-scale", &acoustic_scale, 
"Scaling factor for acoustic likelihoods");
    51     po.
Register(
"inv-acoustic-scale", &inv_acoustic_scale, 
"An alternative way "    52                 "of setting the acoustic scale: you can set its inverse.");
    53     po.
Register(
"lm-scale", &lm_scale, 
"Scaling factor for graph/lm costs");
    54     po.
Register(
"acoustic2lm-scale", &acoustic2lm_scale, 
"Add this times original acoustic costs to LM costs");
    55     po.
Register(
"lm2acoustic-scale", &lm2acoustic_scale, 
"Add this times original LM costs to acoustic costs");
    64     std::string lats_rspecifier = po.
GetArg(1),
    65         lats_wspecifier = po.
GetArg(2);
    69     KALDI_ASSERT(acoustic_scale == 1.0 || inv_acoustic_scale == 1.0);
    70     if (inv_acoustic_scale != 1.0)
    71       acoustic_scale = 1.0 / inv_acoustic_scale;
    73     std::vector<std::vector<double> > scale(2);
    76     scale[0][0] = lm_scale;
    77     scale[0][1] = acoustic2lm_scale;
    78     scale[1][0] = lm2acoustic_scale;
    79     scale[1][1] = acoustic_scale;
    87       for (; !compact_lattice_reader.
Done(); compact_lattice_reader.
Next()) {
    90         compact_lattice_writer.
Write(compact_lattice_reader.
Key(), lat);
    99       for (; !lattice_reader.
Done(); lattice_reader.
Next()) {
   102         lattice_writer.
Write(lattice_reader.
Key(), lat);
   107     KALDI_LOG << 
"Done " << n_done << 
" lattices.";
   108     return (n_done != 0 ? 0 : 1);
   109   } 
catch(
const std::exception &e) {
   110     std::cerr << e.what();
 
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
 
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
 
void Register(const std::string &name, bool *ptr, const std::string &doc)
 
The class ParseOptions is for parsing command-line options; see Parsing command-line options for more...
 
int main(int argc, char *argv[])
 
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...
 
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. 
 
fst::VectorFst< CompactLatticeArc > CompactLattice
 
int NumArgs() const
Number of positional parameters (c.f. argc-1). 
 
#define KALDI_ASSERT(cond)