26 int main(
int argc,
char *argv[]) {
28 using namespace kaldi;
30 typedef kaldi::int64 int64;
31 using fst::SymbolTable;
38 "Reverse a lattice in order to rescore the lattice with a RNNLM \n" 39 "trained reversed text. An example for its application is at \n" 40 "swbd/local/rnnlm/run_lstm_tdnn_back.sh\n" 41 "Usage: lattice-reverse lattice-rspecifier lattice-wspecifier\n" 42 " e.g.: lattice-reverse ark:forward.lats ark:backward.lats\n";
45 std::string include_rxfilename;
46 std::string exclude_rxfilename;
55 std::string lats_rspecifier = po.
GetArg(1),
56 lats_wspecifier = po.
GetArg(2);
63 for (; !lattice_reader.
Done(); lattice_reader.
Next(), n_done++) {
64 string key = lattice_reader.
Key();
67 fst::Reverse(lat, &olat);
68 lattice_writer.
Write(lattice_reader.
Key(), olat);
71 KALDI_LOG <<
"Done reversing " << n_done <<
" lattices.";
73 return (n_done != 0 ? 0 : 1);
74 }
catch(
const std::exception &e) {
75 std::cerr << e.what();
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...
fst::VectorFst< LatticeArc > Lattice
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.
int NumArgs() const
Number of positional parameters (c.f. argc-1).
int main(int argc, char *argv[])