22 #ifndef KALDI_DECODER_SIMPLE_DECODER_H_ 23 #define KALDI_DECODER_SIMPLE_DECODER_H_ 27 #include "fst/fstlib.h" 86 int32 max_num_frames = -1);
103 Token *prev): prev_(prev), ref_count_(1) {
104 arc_.ilabel = arc.ilabel;
105 arc_.olabel = arc.olabel;
106 arc_.weight =
LatticeWeight(arc.weight.Value(), acoustic_cost);
107 arc_.nextstate = arc.nextstate;
110 cost_ = prev->
cost_ + (arc.weight.Value() + acoustic_cost);
112 cost_ = arc.weight.Value() + acoustic_cost;
116 return cost_ > other.
cost_;
123 if (prev == NULL)
return;
126 #ifdef KALDI_PARANOID 140 const fst::Fst<fst::StdArc> &
fst_;
145 static void ClearToks(unordered_map<StateId, Token*> &toks);
fst::StdArc::StateId StateId
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
fst::ArcTpl< LatticeWeight > LatticeArc
void ProcessEmitting(DecodableInterface *decodable)
int32 num_frames_decoded_
unordered_map< StateId, Token * > cur_toks_
DecodableInterface provides a link between the (acoustic-modeling and feature-processing) code and th...
For an extended explanation of the framework of which grammar-fsts are a part, please see Support for...
unordered_map< StateId, Token * > prev_toks_
static void ClearToks(unordered_map< StateId, Token *> &toks)
bool ReachedFinal() const
void ProcessNonemitting()
KALDI_DISALLOW_COPY_AND_ASSIGN(SimpleDecoder)
int32 NumFramesDecoded() const
Returns the number of frames already decoded.
bool operator<(const Token &other)
BaseFloat FinalRelativeCost() const
*** The next functions are from the "new interface". ***
fst::LatticeWeightTpl< BaseFloat > LatticeWeight
const fst::Fst< fst::StdArc > & fst_
fst::VectorFst< LatticeArc > Lattice
static void PruneToks(BaseFloat beam, unordered_map< StateId, Token *> *toks)
fst::StdArc::Weight Weight
SimpleDecoder(const fst::Fst< fst::StdArc > &fst, BaseFloat beam)
#define KALDI_ASSERT(cond)
bool Decode(DecodableInterface *decodable)
Decode this utterance.
static void TokenDelete(Token *tok)
Simplest possible decoder, included largely for didactic purposes and as a means to debug more highly...
Token(const StdArc &arc, BaseFloat acoustic_cost, Token *prev)
void AdvanceDecoding(DecodableInterface *decodable, int32 max_num_frames=-1)
This will decode until there are no more frames ready in the decodable object, but if max_num_frames ...
bool GetBestPath(Lattice *fst_out, bool use_final_probs=true) const
void InitDecoding()
InitDecoding initializes the decoding, and should only be used if you intend to call AdvanceDecoding(...