21 #ifndef KALDI_DECODER_FASTER_DECODER_H_ 22 #define KALDI_DECODER_FASTER_DECODER_H_ 27 #include "fst/fstlib.h" 40 max_active(std::numeric_limits<
int32>::max()),
46 opts->
Register(
"beam", &beam,
"Decoding beam. Larger->slower, more accurate.");
49 opts->
Register(
"max-active", &max_active,
"Decoder max active states. Larger->slower; " 51 opts->
Register(
"min-active", &min_active,
52 "Decoder min active states (don't prune if #active less than this).");
54 opts->
Register(
"beam-delta", &beam_delta,
55 "Increment used in decoder [obscure setting]");
56 opts->
Register(
"hash-ratio", &hash_ratio,
57 "Setting used in decoder to control hash behavior");
79 bool ReachedFinal()
const;
87 bool GetBestPath(fst::MutableFst<LatticeArc> *fst_out,
88 bool use_final_probs =
true);
99 int32 max_num_frames = -1);
117 arc_(arc), prev_(prev), ref_count_(1) {
120 cost_ = prev->
cost_ + arc.weight.Value() + ac_cost;
122 cost_ = arc.weight.Value() + ac_cost;
126 arc_(arc), prev_(prev), ref_count_(1) {
129 cost_ = prev->
cost_ + arc.weight.Value();
131 cost_ = arc.weight.Value();
135 return cost_ > other.
cost_;
142 if (prev == NULL)
return;
145 #ifdef KALDI_PARANOID 154 double GetCutoff(Elem *list_head,
size_t *tok_count,
155 BaseFloat *adaptive_beam, Elem **best_elem);
157 void PossiblyResizeHash(
size_t num_toks);
165 void ProcessNonemitting(
double cutoff);
171 const fst::Fst<fst::StdArc> &
fst_;
186 void ClearToks(Elem *list);
fst::StdArc::StateId StateId
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
Token(const Arc &arc, BaseFloat ac_cost, Token *prev)
DecodableInterface provides a link between the (acoustic-modeling and feature-processing) code and th...
void SetOptions(const FasterDecoderOptions &config)
FasterDecoderOptions config_
For an extended explanation of the framework of which grammar-fsts are a part, please see Support for...
Token(const Arc &arc, Token *prev)
#define KALDI_DISALLOW_COPY_AND_ASSIGN(type)
virtual void Register(const std::string &name, bool *ptr, const std::string &doc)=0
static void TokenDelete(Token *tok)
const fst::Fst< fst::StdArc > & fst_
void Register(OptionsItf *opts, bool full)
HashList< StateId, Token * > toks_
fst::StdArc::Weight Weight
int32 NumFramesDecoded() const
Returns the number of frames already decoded.
bool operator<(const Int32Pair &a, const Int32Pair &b)
HashList< StateId, Token * >::Elem Elem
#define KALDI_ASSERT(cond)
int32 num_frames_decoded_
std::vector< BaseFloat > tmp_array_
std::vector< const Elem *> queue_