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.");
86 if (po.NumArgs() > 2) {
91 std::string fst_in_str = po.GetOptArg(1),
92 fst_out_str = po.GetOptArg(2);
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());
120 fst_reader.FreeCurrent();
121 ArcSort(&fst, ILabelCompare<StdArc>());
126 VectorFst<StdArc> det_fst;
131 fst_writer.Write(key, 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...
A templated class for writing objects to an archive or script file; see The Table concept...
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...
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...