28 int main(
int argc,
char *argv[]) {
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";
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...
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
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...
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).
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.
int main(int argc, char *argv[])
std::string GetOptArg(int param) const