30 using namespace kaldi;
32 typedef kaldi::int64 int64;
39 "For each lattice, compute a vector of length (num-frames) saying how\n" 40 "may arcs cross each frame. See also lattice-depth\n" 41 "Usage: lattice-depth-per-frame <lattice-rspecifier> <depth-wspecifier> [<lattice-wspecifier>]\n" 42 "The final <lattice-wspecifier> allows you to write the input lattices out\n" 43 "in case you want to do something else with them as part of the same pipe.\n" 44 "E.g.: lattice-depth-per-frame ark:- ark,t:-\n";
50 if (po.NumArgs() < 2 || po.NumArgs() > 3) {
55 std::string lats_rspecifier = po.GetArg(1);
58 std::string depth_wspecifier = po.GetArg(2);
61 std::string lattice_wspecifier = po.GetOptArg(3);
66 for (; !clat_reader.Done(); clat_reader.Next()) {
68 std::string key = clat_reader.Key();
72 std::vector<int32> depth_per_frame;
75 lats_depth_writer.Write(key, depth_per_frame);
77 if (!lattice_wspecifier.empty())
78 clat_writer.Write(key, clat);
82 KALDI_LOG <<
"Done " << num_done <<
" lattices.";
83 if (num_done != 0)
return 0;
85 }
catch (
const std::exception &e) {
86 std::cerr << e.what();
fst::StdArc::StateId StateId
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...
A templated class for reading objects sequentially from an archive or script file; see The Table conc...
fst::VectorFst< CompactLatticeArc > CompactLattice
void TopSortCompactLatticeIfNeeded(CompactLattice *clat)
Topologically sort the compact lattice if not already topologically sorted.
void CompactLatticeDepthPerFrame(const CompactLattice &clat, std::vector< int32 > *depth_per_frame)
This function returns, for each frame, the number of arcs crossing that frame.