You will instantiate this class when you want to decode a single utterance using the online-decoding setup for neural nets. More...
#include <online-nnet3-decoding.h>
Public Member Functions | |
SingleUtteranceNnet3DecoderTpl (const LatticeFasterDecoderConfig &decoder_opts, const TransitionModel &trans_model, const nnet3::DecodableNnetSimpleLoopedInfo &info, const FST &fst, OnlineNnet2FeaturePipeline *features) | |
void | InitDecoding (int32 frame_offset=0) |
Initializes the decoding and sets the frame offset of the underlying decodable object. More... | |
void | AdvanceDecoding () |
Advances 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 LatticeFasterOnlineDecoderTpl< FST > & | Decoder () const |
~SingleUtteranceNnet3DecoderTpl () | |
Private Attributes | |
const LatticeFasterDecoderConfig & | decoder_opts_ |
BaseFloat | input_feature_frame_shift_in_seconds_ |
const TransitionModel & | trans_model_ |
nnet3::DecodableAmNnetLoopedOnline | decodable_ |
LatticeFasterOnlineDecoderTpl< FST > | decoder_ |
You will instantiate this class when you want to decode a single utterance using the online-decoding setup for neural nets.
The template will be instantiated only for FST = fst::Fst<fst::StdArc> and FST = fst::GrammarFst.
Definition at line 52 of file online-nnet3-decoding.h.
SingleUtteranceNnet3DecoderTpl | ( | const LatticeFasterDecoderConfig & | decoder_opts, |
const TransitionModel & | trans_model, | ||
const nnet3::DecodableNnetSimpleLoopedInfo & | info, | ||
const FST & | fst, | ||
OnlineNnet2FeaturePipeline * | features | ||
) |
Definition at line 29 of file online-nnet3-decoding.cc.
References SingleUtteranceNnet3DecoderTpl< FST >::decoder_.
|
inline |
Definition at line 101 of file online-nnet3-decoding.h.
void AdvanceDecoding | ( | ) |
Advances the decoding as far as we can.
Definition at line 51 of file online-nnet3-decoding.cc.
References SingleUtteranceNnet3DecoderTpl< FST >::decodable_, and SingleUtteranceNnet3DecoderTpl< FST >::decoder_.
Referenced by main().
|
inline |
Definition at line 99 of file online-nnet3-decoding.h.
References SingleUtteranceNnet3DecoderTpl< FST >::decoder_.
Referenced by main().
bool EndpointDetected | ( | const OnlineEndpointConfig & | config | ) |
This function calls EndpointDetected from online-endpoint.h, with the required arguments.
Definition at line 88 of file online-nnet3-decoding.cc.
References SingleUtteranceNnet3DecoderTpl< FST >::decodable_, SingleUtteranceNnet3DecoderTpl< FST >::decoder_, kaldi::EndpointDetected(), DecodableNnetLoopedOnlineBase::FrameSubsamplingFactor(), SingleUtteranceNnet3DecoderTpl< FST >::input_feature_frame_shift_in_seconds_, and SingleUtteranceNnet3DecoderTpl< FST >::trans_model_.
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 56 of file online-nnet3-decoding.cc.
References SingleUtteranceNnet3DecoderTpl< FST >::decoder_.
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 82 of file online-nnet3-decoding.cc.
References SingleUtteranceNnet3DecoderTpl< FST >::decoder_.
Referenced by main().
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 66 of file online-nnet3-decoding.cc.
References SingleUtteranceNnet3DecoderTpl< FST >::decoder_, SingleUtteranceNnet3DecoderTpl< FST >::decoder_opts_, LatticeFasterDecoderConfig::det_opts, LatticeFasterDecoderConfig::determinize_lattice, fst::DeterminizeLatticePhonePrunedWrapper(), KALDI_ERR, LatticeFasterDecoderConfig::lattice_beam, SingleUtteranceNnet3DecoderTpl< FST >::NumFramesDecoded(), and SingleUtteranceNnet3DecoderTpl< FST >::trans_model_.
Referenced by main().
void InitDecoding | ( | int32 | frame_offset = 0 | ) |
Initializes the decoding and sets the frame offset of the underlying decodable object.
This method is called by the constructor. You can also call this method when you want to reset the decoder state, but want to keep using the same decodable object, e.g. in case of an endpoint.
Definition at line 45 of file online-nnet3-decoding.cc.
References SingleUtteranceNnet3DecoderTpl< FST >::decodable_, SingleUtteranceNnet3DecoderTpl< FST >::decoder_, and DecodableNnetLoopedOnlineBase::SetFrameOffset().
Referenced by main().
int32 NumFramesDecoded | ( | ) | const |
Definition at line 61 of file online-nnet3-decoding.cc.
References SingleUtteranceNnet3DecoderTpl< FST >::decoder_.
Referenced by SingleUtteranceNnet3DecoderTpl< FST >::GetLattice(), and main().
|
private |
Definition at line 114 of file online-nnet3-decoding.h.
Referenced by SingleUtteranceNnet3DecoderTpl< FST >::AdvanceDecoding(), SingleUtteranceNnet3DecoderTpl< FST >::EndpointDetected(), and SingleUtteranceNnet3DecoderTpl< FST >::InitDecoding().
|
private |
Definition at line 116 of file online-nnet3-decoding.h.
Referenced by SingleUtteranceNnet3DecoderTpl< FST >::AdvanceDecoding(), SingleUtteranceNnet3DecoderTpl< FST >::Decoder(), SingleUtteranceNnet3DecoderTpl< FST >::EndpointDetected(), SingleUtteranceNnet3DecoderTpl< FST >::FinalizeDecoding(), SingleUtteranceNnet3DecoderTpl< FST >::GetBestPath(), SingleUtteranceNnet3DecoderTpl< FST >::GetLattice(), SingleUtteranceNnet3DecoderTpl< FST >::InitDecoding(), SingleUtteranceNnet3DecoderTpl< FST >::NumFramesDecoded(), and SingleUtteranceNnet3DecoderTpl< FST >::SingleUtteranceNnet3DecoderTpl().
|
private |
Definition at line 104 of file online-nnet3-decoding.h.
Referenced by SingleUtteranceNnet3DecoderTpl< FST >::GetLattice().
|
private |
Definition at line 108 of file online-nnet3-decoding.h.
Referenced by SingleUtteranceNnet3DecoderTpl< FST >::EndpointDetected().
|
private |
Definition at line 112 of file online-nnet3-decoding.h.
Referenced by SingleUtteranceNnet3DecoderTpl< FST >::EndpointDetected(), and SingleUtteranceNnet3DecoderTpl< FST >::GetLattice().