23 #include "fst/fstlib.h" 27 #if !defined(_MSC_VER) && !defined(__APPLE__) 59 debug_location =
true;
64 int main(
int argc,
char *argv[]) {
66 using namespace kaldi;
71 "Removes epsilons and determinizes in one step\n" 73 "Usage: fstdeterminizestar [in.fst [out.fst] ]\n" 75 "See also: fstdeterminizelog, lattice-determinize\n";
81 po.
Register(
"use-log", &use_log,
"Determinize in log semiring.");
82 po.
Register(
"delta", &delta,
"Delta value used to determine equivalence of weights.");
83 po.
Register(
"max-states", &max_states,
"Maximum number of states in determinized FST before it will abort.");
96 #if !defined(_MSC_VER) && !defined(__APPLE__) 103 ArcSort(fst, ILabelCompare<StdArc>());
107 VectorFst<StdArc> det_fst;
117 for (; !fst_reader.
Done(); fst_reader.
Next()) {
118 std::string key = fst_reader.
Key();
119 VectorFst<StdArc>
fst(fst_reader.
Value());
121 ArcSort(&
fst, ILabelCompare<StdArc>());
126 VectorFst<StdArc> det_fst;
132 }
catch (
const std::runtime_error &e) {
133 KALDI_WARN <<
"Error during determinization for key " << key;
138 }
catch(
const std::exception &e) {
139 std::cerr << e.what();
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
For an extended explanation of the framework of which grammar-fsts are a part, please see Support 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
void Register(const std::string &name, bool *ptr, const std::string &doc)
RspecifierType ClassifyRspecifier(const std::string &rspecifier, std::string *rxfilename, RspecifierOptions *opts)
void DeterminizeStarInLog(VectorFst< StdArc > *fst, float delta, bool *debug_ptr, int max_states)
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.
int NumArgs() const
Number of positional parameters (c.f. argc-1).
int main(int argc, char *argv[])
void WriteFstKaldi(std::ostream &os, bool binary, const VectorFst< Arc > &t)
void ReadFstKaldi(std::istream &is, bool binary, VectorFst< Arc > *fst)
bool DeterminizeStar(F &ifst, MutableFst< typename F::Arc > *ofst, float delta, bool *debug_ptr, int max_states, bool allow_partial)
This function implements the normal version of DeterminizeStar, in which the output strings are repre...
std::string GetOptArg(int param) const