23 int main(
int argc,
char *argv[]) {
24 using namespace kaldi;
25 typedef kaldi::int64 int64;
28 "Add word insertion penalty to the lattice.\n" 29 "Note: penalties are negative log-probs, base e, and are added to the\n" 30 "'language model' part of the cost.\n" 32 "Usage: lattice-add-penalty [options] <lattice-rspecifier> <lattice-wspecifier>\n" 33 " e.g.: lattice-add-penalty --word-ins-penalty=1.0 ark:- ark:-\n";
39 po.
Register(
"word-ins-penalty", &word_ins_penalty,
"Word insertion penalty");
48 std::string lats_rspecifier = po.
GetArg(1),
49 lats_wspecifier = po.
GetArg(2);
56 for (; !clat_reader.
Done(); clat_reader.
Next()) {
59 clat_writer.
Write(clat_reader.
Key(), clat);
62 KALDI_LOG <<
"Done adding word insertion penalty to " << n_done <<
" lattices.";
63 return (n_done != 0 ? 0 : 1);
64 }
catch(
const std::exception &e) {
65 std::cerr << e.what();
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
int main(int argc, char *argv[])
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
void Register(const std::string &name, bool *ptr, const std::string &doc)
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.
void AddWordInsPenToCompactLattice(BaseFloat word_ins_penalty, CompactLattice *clat)
This function add the word insertion penalty to graph score of each word in the compact lattice...
fst::VectorFst< CompactLatticeArc > CompactLattice
int NumArgs() const
Number of positional parameters (c.f. argc-1).