31 using namespace kaldi;
33 typedef kaldi::int64 int64;
34 using fst::SymbolTable;
39 "Add transition probabilities into graph part of lattice scores,\n" 40 "controlled by options --transition-scale and --self-loop-scale, which\n" 41 "for compatibility with the original graph, would normally be set to the same\n" 42 "values used in graph compilatoin\n" 44 "Usage: lattice-add-trans-probs [options] model lattice-rspecifier lattice-wspecifier\n" 45 " e.g.: lattice-add-trans-probs --transition-scale=1.0 --self-loop-scale=0.1 1.mdl ark:in.lats ark:out.lats\n";
49 BaseFloat transition_scale = 1.0, self_loop_scale = 1.0;
51 po.Register(
"transition-scale", &transition_scale,
52 "Scale for transition probabilities (excluding self-loops)");
53 po.Register(
"self-loop-scale", &self_loop_scale,
54 "Probability scale for self-loop vs. non-self-loop " 59 if (po.NumArgs() != 3) {
65 model_rxfilename = po.GetArg(1),
66 lats_rspecifier = po.GetArg(2),
67 lats_wspecifier = po.GetArg(3);
78 for (; !lattice_reader.Done(); lattice_reader.Next(), n_done++) {
79 Lattice lat(lattice_reader.Value());
83 clat_writer.Write(lattice_reader.Key(), clat);
86 KALDI_LOG <<
"Done adding transition probabilities to " << n_done <<
" lattices.";
87 return (n_done != 0 ? 0 : 1);
88 }
catch(
const std::exception &e) {
89 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...
void ReadKaldiObject(const std::string &filename, Matrix< float > *m)
void AddTransitionProbs(const TransitionModel &trans_model, const std::vector< int32 > &disambig_syms, BaseFloat transition_scale, BaseFloat self_loop_scale, fst::VectorFst< fst::StdArc > *fst)
Adds transition-probs, with the supplied scales (see Scaling of transition and acoustic probabilities...
The class ParseOptions is for parsing command-line options; see Parsing command-line options for more...
void ConvertLattice(const ExpandedFst< ArcTpl< Weight > > &ifst, MutableFst< ArcTpl< CompactLatticeWeightTpl< Weight, Int > > > *ofst, bool invert)
Convert lattice from a normal FST to a CompactLattice FST.
A templated class for reading objects sequentially from an archive or script file; see The Table conc...
fst::VectorFst< LatticeArc > Lattice
fst::VectorFst< CompactLatticeArc > CompactLattice