#include <faster-decoder.h>


Classes | |
| class | Token | 
Public Types | |
| typedef fst::StdArc | Arc | 
| typedef Arc::Label | Label | 
| typedef Arc::StateId | StateId | 
| typedef Arc::Weight | Weight | 
Public Member Functions | |
| FasterDecoder (const fst::Fst< fst::StdArc > &fst, const FasterDecoderOptions &config) | |
| void | SetOptions (const FasterDecoderOptions &config) | 
| ~FasterDecoder () | |
| void | Decode (DecodableInterface *decodable) | 
| bool | ReachedFinal () const | 
| Returns true if a final state was active on the last frame.  More... | |
| bool | GetBestPath (fst::MutableFst< LatticeArc > *fst_out, bool use_final_probs=true) | 
| GetBestPath gets the decoding traceback.  More... | |
| void | InitDecoding () | 
| As a new alternative to Decode(), you can call InitDecoding and then (possibly multiple times) AdvanceDecoding().  More... | |
| 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 is >= 0 it will decode no more than that many frames.  More... | |
| int32 | NumFramesDecoded () const | 
| Returns the number of frames already decoded.  More... | |
Protected Types | |
| typedef HashList< StateId, Token * >::Elem | Elem | 
Protected Member Functions | |
| double | GetCutoff (Elem *list_head, size_t *tok_count, BaseFloat *adaptive_beam, Elem **best_elem) | 
| Gets the weight cutoff. Also counts the active tokens.  More... | |
| void | PossiblyResizeHash (size_t num_toks) | 
| double | ProcessEmitting (DecodableInterface *decodable) | 
| void | ProcessNonemitting (double cutoff) | 
| void | ClearToks (Elem *list) | 
| KALDI_DISALLOW_COPY_AND_ASSIGN (FasterDecoder) | |
Protected Attributes | |
| HashList< StateId, Token * > | toks_ | 
| const fst::Fst< fst::StdArc > & | fst_ | 
| FasterDecoderOptions | config_ | 
| std::vector< const Elem *> | queue_ | 
| std::vector< BaseFloat > | tmp_array_ | 
| int32 | num_frames_decoded_ | 
Definition at line 62 of file faster-decoder.h.
| typedef fst::StdArc Arc | 
Definition at line 64 of file faster-decoder.h.
Definition at line 150 of file faster-decoder.h.
| typedef Arc::Label Label | 
Definition at line 65 of file faster-decoder.h.
| typedef Arc::StateId StateId | 
Definition at line 66 of file faster-decoder.h.
| typedef Arc::Weight Weight | 
Definition at line 67 of file faster-decoder.h.
| FasterDecoder | ( | const fst::Fst< fst::StdArc > & | fst, | 
| const FasterDecoderOptions & | config | ||
| ) | 
Definition at line 26 of file faster-decoder.cc.
References FasterDecoder::config_, FasterDecoderOptions::hash_ratio, KALDI_ASSERT, FasterDecoderOptions::max_active, FasterDecoderOptions::min_active, HashList< I, T >::SetSize(), and FasterDecoder::toks_.
      
  | 
  inline | 
Definition at line 74 of file faster-decoder.h.
| 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 is >= 0 it will decode no more than that many frames.
Definition at line 53 of file faster-decoder.cc.
References KALDI_ASSERT, FasterDecoder::num_frames_decoded_, DecodableInterface::NumFramesReady(), FasterDecoder::ProcessEmitting(), and FasterDecoder::ProcessNonemitting().
Referenced by FasterDecoder::Decode().
      
  | 
  protected | 
Definition at line 343 of file faster-decoder.cc.
References HashList< I, T >::Delete(), FasterDecoder::Token::TokenDelete(), and FasterDecoder::toks_.
Referenced by FasterDecoder::InitDecoding(), and OnlineFasterDecoder::ResetDecoder().
| void Decode | ( | DecodableInterface * | decodable | ) | 
Definition at line 48 of file faster-decoder.cc.
References FasterDecoder::AdvanceDecoding(), and FasterDecoder::InitDecoding().
Referenced by kaldi::AlignUtteranceWrapper(), DecodeUtterance(), and main().
| bool GetBestPath | ( | fst::MutableFst< LatticeArc > * | fst_out, | 
| bool | use_final_probs = true  | 
        ||
| ) | 
GetBestPath gets the decoding traceback.
If "use_final_probs" is true AND we reached a final state, it limits itself to final states; otherwise it gets the most likely token not taking into account final-probs. Returns true if the output best path was not the empty FST (will only return false in unusual circumstances where no tokens survived).
Definition at line 84 of file faster-decoder.cc.
References FasterDecoder::Token::arc_, FasterDecoder::Token::cost_, FasterDecoder::fst_, HashList< I, T >::GetList(), rnnlm::i, KALDI_ASSERT, LatticeWeightTpl< BaseFloat >::One(), FasterDecoder::Token::prev_, FasterDecoder::ReachedFinal(), fst::RemoveEpsLocal(), HashList< I, T >::Elem::tail, and FasterDecoder::toks_.
Referenced by kaldi::AlignUtteranceWrapper(), DecodeUtterance(), and main().
      
  | 
  protected | 
Gets the weight cutoff. Also counts the active tokens.
Definition at line 148 of file faster-decoder.cc.
References FasterDecoderOptions::beam, FasterDecoderOptions::beam_delta, FasterDecoder::config_, count, FasterDecoderOptions::max_active, FasterDecoderOptions::min_active, HashList< I, T >::Elem::tail, and FasterDecoder::tmp_array_.
Referenced by FasterDecoder::ProcessEmitting().
| void InitDecoding | ( | ) | 
As a new alternative to Decode(), you can call InitDecoding and then (possibly multiple times) AdvanceDecoding().
Definition at line 36 of file faster-decoder.cc.
References HashList< I, T >::Clear(), FasterDecoder::ClearToks(), FasterDecoder::fst_, HashList< I, T >::Insert(), KALDI_ASSERT, FasterDecoder::num_frames_decoded_, FasterDecoder::ProcessNonemitting(), and FasterDecoder::toks_.
Referenced by FasterDecoder::Decode(), and main().
      
  | 
  protected | 
      
  | 
  inline | 
      
  | 
  protected | 
Definition at line 212 of file faster-decoder.cc.
References FasterDecoder::config_, FasterDecoderOptions::hash_ratio, HashList< I, T >::SetSize(), HashList< I, T >::Size(), and FasterDecoder::toks_.
Referenced by FasterDecoder::ProcessEmitting().
      
  | 
  protected | 
Definition at line 221 of file faster-decoder.cc.
References FasterDecoder::Token::arc_, HashList< I, T >::Clear(), FasterDecoder::Token::cost_, HashList< I, T >::Delete(), FasterDecoder::fst_, FasterDecoder::GetCutoff(), HashList< I, T >::Insert(), KALDI_ASSERT, KALDI_VLOG, HashList< I, T >::Elem::key, DecodableInterface::LogLikelihood(), FasterDecoder::num_frames_decoded_, FasterDecoder::PossiblyResizeHash(), FasterDecoder::Token::TokenDelete(), FasterDecoder::toks_, and HashList< I, T >::Elem::val.
Referenced by FasterDecoder::AdvanceDecoding(), and OnlineFasterDecoder::Decode().
      
  | 
  protected | 
Definition at line 301 of file faster-decoder.cc.
References FasterDecoder::Token::arc_, FasterDecoder::Token::cost_, FasterDecoder::fst_, HashList< I, T >::GetList(), HashList< I, T >::Insert(), KALDI_ASSERT, HashList< I, T >::Elem::key, FasterDecoder::queue_, HashList< I, T >::Elem::tail, FasterDecoder::Token::TokenDelete(), FasterDecoder::toks_, and HashList< I, T >::Elem::val.
Referenced by FasterDecoder::AdvanceDecoding(), OnlineFasterDecoder::Decode(), and FasterDecoder::InitDecoding().
| bool ReachedFinal | ( | ) | const | 
Returns true if a final state was active on the last frame.
Definition at line 75 of file faster-decoder.cc.
References FasterDecoder::fst_, HashList< I, T >::GetList(), HashList< I, T >::Elem::tail, and FasterDecoder::toks_.
Referenced by kaldi::AlignUtteranceWrapper(), DecodeUtterance(), OnlineFasterDecoder::FinishTraceBack(), FasterDecoder::GetBestPath(), and main().
      
  | 
  inline | 
      
  | 
  protected | 
Definition at line 172 of file faster-decoder.h.
Referenced by FasterDecoder::FasterDecoder(), FasterDecoder::GetCutoff(), and FasterDecoder::PossiblyResizeHash().
      
  | 
  protected | 
Definition at line 171 of file faster-decoder.h.
Referenced by OnlineFasterDecoder::FinishTraceBack(), GrammarFstPreparer::FixArcsToFinalStates(), FasterDecoder::GetBestPath(), FasterDecoder::InitDecoding(), GrammarFstPreparer::InsertEpsilonsForState(), GrammarFstPreparer::IsEntryState(), GrammarFstPreparer::IsSpecialState(), OnlineFasterDecoder::MakeLattice(), GrammarFstPreparer::MaybeAddFinalProbToState(), GrammarFstPreparer::NeedEpsilons(), GrammarFstPreparer::Prepare(), FasterDecoder::ProcessEmitting(), FasterDecoder::ProcessNonemitting(), FasterDecoder::ReachedFinal(), OnlineFasterDecoder::ResetDecoder(), and OnlineFasterDecoder::TracebackNFrames().
      
  | 
  protected | 
Definition at line 178 of file faster-decoder.h.
Referenced by FasterDecoder::AdvanceDecoding(), FasterDecoder::InitDecoding(), and FasterDecoder::ProcessEmitting().
      
  | 
  protected | 
Definition at line 173 of file faster-decoder.h.
Referenced by FasterDecoder::ProcessNonemitting().
      
  | 
  protected | 
Definition at line 174 of file faster-decoder.h.
Referenced by FasterDecoder::GetCutoff().
Definition at line 170 of file faster-decoder.h.
Referenced by FasterDecoder::ClearToks(), FasterDecoder::FasterDecoder(), OnlineFasterDecoder::FinishTraceBack(), FasterDecoder::GetBestPath(), FasterDecoder::InitDecoding(), FasterDecoder::PossiblyResizeHash(), FasterDecoder::ProcessEmitting(), FasterDecoder::ProcessNonemitting(), FasterDecoder::ReachedFinal(), OnlineFasterDecoder::ResetDecoder(), OnlineFasterDecoder::TracebackNFrames(), and OnlineFasterDecoder::UpdateImmortalToken().