99 using namespace kaldi;
103 "Determinize lattices, keeping only the best path (sequence of acoustic states)\n" 104 "for each input-symbol sequence. This is a version of lattice-determnize-pruned\n" 105 "that accepts the --num-threads option. These programs do pruning as part of the\n" 106 "determinization algorithm, which is more efficient and prevents blowup.\n" 107 "See http://kaldi-asr.org/doc/lattices.html for more information on lattices.\n" 109 "Usage: lattice-determinize-pruned-parallel [options] lattice-rspecifier lattice-wspecifier\n" 110 " e.g.: lattice-determinize-pruned-parallel --acoustic-scale=0.1 --beam=6.0 ark:in.lats ark:det.lats\n";
115 bool minimize =
false;
120 determinize_config.
max_mem = 50000000;
123 po.Register(
"acoustic-scale", &acoustic_scale,
124 "Scaling factor for acoustic likelihoods");
125 po.Register(
"beam", &beam,
"Pruning beam [applied after acoustic scaling].");
126 po.Register(
"minimize", &minimize,
127 "If true, push and minimize after determinization");
132 if (po.NumArgs() != 2) {
137 std::string lats_rspecifier = po.GetArg(1),
138 lats_wspecifier = po.GetArg(2);
149 int32 n_done = 0, n_warn = 0;
151 if (acoustic_scale == 0.0)
152 KALDI_ERR <<
"Do not use a zero acoustic scale (cannot be inverted)";
154 for (; !lat_reader.Done(); lat_reader.Next()) {
155 std::string key = lat_reader.Key();
157 Lattice *lat = lat_reader.Value().Copy();
160 KALDI_VLOG(2) <<
"Processing lattice " << key;
162 DeterminizeLatticeTask *task =
new DeterminizeLatticeTask(
163 determinize_config, key, acoustic_scale, beam, minimize,
164 lat, &compact_lat_writer, &n_warn);
169 KALDI_LOG <<
"Done " << n_done <<
" lattices, had warnings on " << n_warn
171 return (n_done != 0 ? 0 : 1);
172 }
catch(
const std::exception &e) {
173 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...
void Register(kaldi::OptionsItf *opts)
A templated class for reading objects sequentially from an archive or script file; see The Table conc...
fst::VectorFst< LatticeArc > Lattice
void Register(OptionsItf *opts)