You will instantiate this class when you want to decode a single utterance using the online-decoding setup for neural nets. More...
#include <online-nnet2-decoding.h>
Public Member Functions | |
SingleUtteranceNnet2Decoder (const OnlineNnet2DecodingConfig &config, const TransitionModel &tmodel, const nnet2::AmNnet &model, const fst::Fst< fst::StdArc > &fst, OnlineFeatureInterface *feature_pipeline) | |
void | AdvanceDecoding () |
advance the decoding as far as we can. More... | |
void | FinalizeDecoding () |
Finalizes the decoding. More... | |
int32 | NumFramesDecoded () const |
void | GetLattice (bool end_of_utterance, CompactLattice *clat) const |
Gets the lattice. More... | |
void | GetBestPath (bool end_of_utterance, Lattice *best_path) const |
Outputs an FST corresponding to the single best path through the current lattice. More... | |
bool | EndpointDetected (const OnlineEndpointConfig &config) |
This function calls EndpointDetected from online-endpoint.h, with the required arguments. More... | |
const LatticeFasterOnlineDecoder & | Decoder () const |
~SingleUtteranceNnet2Decoder () | |
You will instantiate this class when you want to decode a single utterance using the online-decoding setup for neural nets.
Definition at line 67 of file online-nnet2-decoding.h.
SingleUtteranceNnet2Decoder | ( | const OnlineNnet2DecodingConfig & | config, |
const TransitionModel & | tmodel, | ||
const nnet2::AmNnet & | model, | ||
const fst::Fst< fst::StdArc > & | fst, | ||
OnlineFeatureInterface * | feature_pipeline | ||
) |
Definition at line 26 of file online-nnet2-decoding.cc.
References SingleUtteranceNnet2Decoder::decoder_, and LatticeFasterDecoderTpl< FST, Token >::InitDecoding().
|
inline |
Definition at line 109 of file online-nnet2-decoding.h.
void AdvanceDecoding | ( | ) |
advance the decoding as far as we can.
Definition at line 40 of file online-nnet2-decoding.cc.
References LatticeFasterDecoderTpl< FST, Token >::AdvanceDecoding(), SingleUtteranceNnet2Decoder::decodable_, and SingleUtteranceNnet2Decoder::decoder_.
Referenced by main().
|
inline |
Definition at line 107 of file online-nnet2-decoding.h.
Referenced by main().
bool EndpointDetected | ( | const OnlineEndpointConfig & | config | ) |
This function calls EndpointDetected from online-endpoint.h, with the required arguments.
Definition at line 72 of file online-nnet2-decoding.cc.
References SingleUtteranceNnet2Decoder::decoder_, kaldi::EndpointDetected(), SingleUtteranceNnet2Decoder::feature_pipeline_, OnlineFeatureInterface::FrameShiftInSeconds(), and SingleUtteranceNnet2Decoder::tmodel_.
Referenced by main().
void FinalizeDecoding | ( | ) |
Finalizes the decoding.
Cleans up and prunes remaining tokens, so the GetLattice() call will return faster. You must not call this before calling (TerminateDecoding() or InputIsFinished()) and then Wait().
Definition at line 44 of file online-nnet2-decoding.cc.
References SingleUtteranceNnet2Decoder::decoder_, and LatticeFasterDecoderTpl< FST, Token >::FinalizeDecoding().
Referenced by main().
Outputs an FST corresponding to the single best path through the current lattice.
If "use_final_probs" is true AND we reached the final-state of the graph then it will include those as final-probs, else it will treat all final-probs as one.
Definition at line 67 of file online-nnet2-decoding.cc.
References SingleUtteranceNnet2Decoder::decoder_, and LatticeFasterOnlineDecoderTpl< FST >::GetBestPath().
void GetLattice | ( | bool | end_of_utterance, |
CompactLattice * | clat | ||
) | const |
Gets the lattice.
The output lattice has any acoustic scaling in it (which will typically be desirable in an online-decoding context); if you want an un-scaled lattice, scale it using ScaleLattice() with the inverse of the acoustic weight. "end_of_utterance" will be true if you want the final-probs to be included.
Definition at line 52 of file online-nnet2-decoding.cc.
References SingleUtteranceNnet2Decoder::config_, SingleUtteranceNnet2Decoder::decoder_, OnlineNnet2DecodingConfig::decoder_opts, LatticeFasterDecoderConfig::det_opts, LatticeFasterDecoderConfig::determinize_lattice, fst::DeterminizeLatticePhonePrunedWrapper(), LatticeFasterDecoderTpl< FST, Token >::GetRawLattice(), KALDI_ERR, LatticeFasterDecoderConfig::lattice_beam, SingleUtteranceNnet2Decoder::NumFramesDecoded(), and SingleUtteranceNnet2Decoder::tmodel_.
Referenced by main().
int32 NumFramesDecoded | ( | ) | const |
Definition at line 48 of file online-nnet2-decoding.cc.
References SingleUtteranceNnet2Decoder::decoder_, and LatticeFasterDecoderTpl< FST, Token >::NumFramesDecoded().
Referenced by SingleUtteranceNnet2Decoder::GetLattice().
|
private |
Definition at line 112 of file online-nnet2-decoding.h.
Referenced by SingleUtteranceNnet2Decoder::GetLattice().
|
private |
Definition at line 118 of file online-nnet2-decoding.h.
Referenced by SingleUtteranceNnet2Decoder::AdvanceDecoding().
|
private |
Definition at line 120 of file online-nnet2-decoding.h.
Referenced by SingleUtteranceNnet2Decoder::AdvanceDecoding(), SingleUtteranceNnet2Decoder::EndpointDetected(), SingleUtteranceNnet2Decoder::FinalizeDecoding(), SingleUtteranceNnet2Decoder::GetBestPath(), SingleUtteranceNnet2Decoder::GetLattice(), SingleUtteranceNnet2Decoder::NumFramesDecoded(), and SingleUtteranceNnet2Decoder::SingleUtteranceNnet2Decoder().
|
private |
Definition at line 114 of file online-nnet2-decoding.h.
Referenced by SingleUtteranceNnet2Decoder::EndpointDetected().
|
private |
Definition at line 116 of file online-nnet2-decoding.h.
Referenced by SingleUtteranceNnet2Decoder::EndpointDetected(), and SingleUtteranceNnet2Decoder::GetLattice().