28 using namespace kaldi;
30 typedef kaldi::int64 int64;
31 using fst::SymbolTable;
36 "Project lattices (in their transducer form); by default makes them\n" 37 "word->word transducers (set --project-output=false for tid->tid).\n" 38 "Usage: lattice-project [options] lattice-rspecifier lattice-wspecifier\n" 39 " e.g.: lattice-project ark:1.lats ark:word2word.lats\n" 40 "or: lattice-project --project-output=false ark:1.lats ark:tid2tid.lats";
43 bool project_output =
true;
45 po.Register(
"project-output", &project_output,
"If true, project on output " 46 "(words), else input (transition-ids)");
50 if (po.NumArgs() != 2) {
55 std::string lats_rspecifier = po.GetArg(1),
56 lats_wspecifier = po.GetArg(2);
63 for (; !clat_reader.Done(); clat_reader.Next()) {
65 std::string key = clat_reader.Key();
66 clat_reader.FreeCurrent();
70 fst::Project(&lat, fst::PROJECT_OUTPUT);
71 lattice_writer.Write(key, lat);
77 for (; !lattice_reader.Done(); lattice_reader.Next()) {
78 std::string key = lattice_reader.Key();
79 Lattice lat = lattice_reader.Value();
80 lattice_reader.FreeCurrent();
81 fst::Project(&lat, fst::PROJECT_INPUT);
82 lattice_writer.Write(key, lat);
86 KALDI_LOG <<
"Done projecting " << 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...
void RemoveAlignmentsFromCompactLattice(MutableFst< ArcTpl< CompactLatticeWeightTpl< Weight, Int > > > *fst)
Removes state-level alignments (the strings that are part of the weights).
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 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