37 fst::VectorFst<Arc> *
fst) {
39 for (StateId s = 0; s < fst->NumStates(); s++) {
40 for (fst::MutableArcIterator<fst::VectorFst<Arc> > aiter(fst, s);
41 !aiter.Done(); aiter.Next()) {
42 Arc arc = aiter.Value();
44 if (arc.ilabel == symbol) {
59 EncodeMapper<KwsProductArc> encoder(kEncodeLabels, ENCODE);
60 Encode(factor_transducer, &encoder);
67 Label epsilon_label = encoder(epsilon_arc).ilabel;
75 KALDI_VLOG(2) <<
"DoFactorMerging: determinization...";
93 Decode(&dest_transducer, encoder);
102 StateId ns = index_transducer->NumStates();
103 for (StateId s = 0; s < ns; s++) {
104 for (MutableArcIterator<KwsLexicographicFst>
105 aiter(index_transducer, s); !aiter.Done(); aiter.Next()) {
107 if (index_transducer->Final(arc.nextstate) != KwsLexicographicWeight::Zero())
118 bool allow_partial) {
121 EncodeMapper<KwsLexicographicArc> encoder(kEncodeLabels, ENCODE);
122 Encode(&ifst, &encoder);
123 KALDI_VLOG(2) <<
"OptimizeFactorTransducer: determinization...";
125 DeterminizeStar(ifst, index_transducer, kDelta, NULL, max_states,
true);
130 }
catch(
const std::exception &e) {
132 *index_transducer = ifst;
135 KALDI_VLOG(2) <<
"OptimizeFactorTransducer: minimization...";
136 Minimize(index_transducer, static_cast<KwsLexicographicFst *>(NULL), fst::kDelta,
true);
137 Decode(index_transducer, encoder);
fst::StdArc::StateId StateId
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
fst::VectorFst< KwsProductArc > KwsProductFst
For an extended explanation of the framework of which grammar-fsts are a part, please see Support for...
StdLStdLStdArc KwsLexicographicArc
fst::VectorFst< KwsLexicographicArc > KwsLexicographicFst
void DoFactorMerging(KwsProductFst *factor_transducer, KwsLexicographicFst *index_transducer)
static void ReplaceSymbolWithEpsilon(typename Arc::Label symbol, fst::VectorFst< Arc > *fst)
void MaybeDoSanityCheck(const KwsLexicographicFst &index_transducer)
#define KALDI_ASSERT(cond)
LogXStdXStdprimeArc KwsProductArc
void DoFactorDisambiguation(KwsLexicographicFst *index_transducer)
void OptimizeFactorTransducer(KwsLexicographicFst *index_transducer, int32 max_states, bool allow_partial)
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...