Classes | |
struct | DeterminizeLatticeOptions |
struct | DeterminizeLatticePrunedOptions |
struct | DeterminizeLatticePhonePrunedOptions |
Functions | |
template<class Weight , class IntType > | |
bool | DeterminizeLattice (const Fst< ArcTpl< Weight > > &ifst, MutableFst< ArcTpl< Weight > > *ofst, DeterminizeLatticeOptions opts=DeterminizeLatticeOptions(), bool *debug_ptr=NULL) |
This function implements the normal version of DeterminizeLattice, in which the output strings are represented using sequences of arcs, where all but the first one has an epsilon on the input side. More... | |
template<class Weight , class IntType > | |
bool | DeterminizeLattice (const Fst< ArcTpl< Weight > > &ifst, MutableFst< ArcTpl< CompactLatticeWeightTpl< Weight, IntType > > > *ofst, DeterminizeLatticeOptions opts, bool *debug_ptr) |
template<class F > | |
bool | DeterminizeStar (F &ifst, MutableFst< typename F::Arc > *ofst, float delta=kDelta, bool *debug_ptr=NULL, int max_states=-1, bool allow_partial=false) |
This function implements the normal version of DeterminizeStar, in which the output strings are represented using sequences of arcs, where all but the first one has an epsilon on the input side. More... | |
template<class F > | |
bool | DeterminizeStar (F &ifst, MutableFst< GallicArc< typename F::Arc > > *ofst, float delta, bool *debug_ptr, int max_states, bool allow_partial) |
template<class Weight > | |
bool | DeterminizeLatticePruned (const ExpandedFst< ArcTpl< Weight > > &ifst, double prune, MutableFst< ArcTpl< Weight > > *ofst, DeterminizeLatticePrunedOptions opts=DeterminizeLatticePrunedOptions()) |
This function implements the normal version of DeterminizeLattice, in which the output strings are represented using sequences of arcs, where all but the first one has an epsilon on the input side. More... | |
template<class Weight , class IntType > | |
bool | DeterminizeLatticePruned (const ExpandedFst< ArcTpl< Weight > > &ifst, double beam, MutableFst< ArcTpl< CompactLatticeWeightTpl< Weight, IntType > > > *ofst, DeterminizeLatticePrunedOptions opts) |
template<class Weight > | |
ArcTpl< Weight >::Label | DeterminizeLatticeInsertPhones (const kaldi::TransitionModel &trans_model, MutableFst< ArcTpl< Weight > > *fst) |
This function takes in lattices and inserts phones at phone boundaries. More... | |
template<class Weight > | |
void | DeterminizeLatticeDeletePhones (typename ArcTpl< Weight >::Label first_phone_label, MutableFst< ArcTpl< Weight > > *fst) |
This function takes in lattices and deletes "phones" from them. More... | |
template<class Weight , class IntType > | |
bool | DeterminizeLatticePhonePruned (const kaldi::TransitionModel &trans_model, const ExpandedFst< ArcTpl< Weight > > &ifst, double prune, MutableFst< ArcTpl< CompactLatticeWeightTpl< Weight, IntType > > > *ofst, DeterminizeLatticePhonePrunedOptions opts=DeterminizeLatticePhonePrunedOptions()) |
This function is a wrapper of DeterminizeLatticePhonePrunedFirstPass() and DeterminizeLatticePruned(). More... | |
template<class Weight , class IntType > | |
bool | DeterminizeLatticePhonePruned (const kaldi::TransitionModel &trans_model, MutableFst< ArcTpl< Weight > > *ifst, double prune, MutableFst< ArcTpl< CompactLatticeWeightTpl< Weight, IntType > > > *ofst, DeterminizeLatticePhonePrunedOptions opts=DeterminizeLatticePhonePrunedOptions()) |
"Destructive" version of DeterminizeLatticePhonePruned() where the input lattice might be changed. More... | |
bool | DeterminizeLatticePhonePrunedWrapper (const kaldi::TransitionModel &trans_model, MutableFst< kaldi::LatticeArc > *ifst, double prune, MutableFst< kaldi::CompactLatticeArc > *ofst, DeterminizeLatticePhonePrunedOptions opts=DeterminizeLatticePhonePrunedOptions()) |
This function is a wrapper of DeterminizeLatticePhonePruned() that works for Lattice type FSTs. More... | |
bool DeterminizeLattice | ( | const Fst< ArcTpl< Weight > > & | ifst, |
MutableFst< ArcTpl< Weight > > * | ofst, | ||
DeterminizeLatticeOptions | opts = DeterminizeLatticeOptions() , |
||
bool * | debug_ptr = NULL |
||
) |
This function implements the normal version of DeterminizeLattice, in which the output strings are represented using sequences of arcs, where all but the first one has an epsilon on the input side.
The debug_ptr argument is an optional pointer to a bool that, if it becomes true while the algorithm is executing, the algorithm will print a traceback and terminate (used in fstdeterminizestar.cc debug non-terminating determinization). More efficient if ifst is arc-sorted on input label. If the number of arcs gets more than max_states, it will throw std::runtime_error (otherwise this code does not use exceptions). This is mainly useful for debug.
Definition at line 1264 of file determinize-lattice-inl.h.
References LatticeDeterminizer< Weight, IntType >::Determinize(), and LatticeDeterminizer< Weight, IntType >::Output().
Referenced by DeterminizeLatticeOptions::DeterminizeLatticeOptions(), kaldi::DeterminizeLatticeWrapper(), main(), and kaldi::RandDeterministicCompactLattice().
bool DeterminizeLattice | ( | const Fst< ArcTpl< Weight > > & | ifst, |
MutableFst< ArcTpl< CompactLatticeWeightTpl< Weight, IntType > > > * | ofst, | ||
DeterminizeLatticeOptions | opts, | ||
bool * | debug_ptr | ||
) |
Definition at line 1281 of file determinize-lattice-inl.h.
References LatticeDeterminizer< Weight, IntType >::Determinize(), and LatticeDeterminizer< Weight, IntType >::Output().
void DeterminizeLatticeDeletePhones | ( | typename ArcTpl< Weight >::Label | first_phone_label, |
MutableFst< ArcTpl< Weight > > * | fst | ||
) |
This function takes in lattices and deletes "phones" from them.
The "phones" here are actually any label that is larger than first_phone_label because when we insert phones into the lattice, we map the original phone label to (first_phone_label + original_phone_label). It is supposed to be used together with DeterminizeLatticeInsertPhones()
Definition at line 1352 of file determinize-lattice-pruned.cc.
References LatticeDeterminizerPruned< Weight, IntType >::Element::state.
Referenced by fst::DeterminizeLatticePhonePrunedFirstPass(), and DeterminizeLatticePhonePrunedOptions::Register().
ArcTpl< Weight >::Label DeterminizeLatticeInsertPhones | ( | const kaldi::TransitionModel & | trans_model, |
MutableFst< ArcTpl< Weight > > * | fst | ||
) |
This function takes in lattices and inserts phones at phone boundaries.
It uses the transition model to work out the transition_id to phone map. The returning value is the starting index of the phone label. Typically we pick (maximum_output_label_index + 1) as this value. The inserted phones are then mapped to (returning_value + original_phone_label) in the new lattice. The returning value will be used by DeterminizeLatticeDeletePhones() where it works out the phones according to this value.
Definition at line 1296 of file determinize-lattice-pruned.cc.
References fst::HighestNumberedInputSymbol(), TransitionModel::IsSelfLoop(), KALDI_ASSERT, LatticeDeterminizerPruned< Weight, IntType >::Element::state, TransitionModel::TransitionIdToHmmState(), and TransitionModel::TransitionIdToPhone().
Referenced by fst::DeterminizeLatticePhonePrunedFirstPass(), and DeterminizeLatticePhonePrunedOptions::Register().
bool DeterminizeLatticePhonePruned | ( | const kaldi::TransitionModel & | trans_model, |
MutableFst< ArcTpl< Weight > > * | ifst, | ||
double | beam, | ||
MutableFst< ArcTpl< CompactLatticeWeightTpl< Weight, IntType > > > * | ofst, | ||
DeterminizeLatticePhonePrunedOptions | opts | ||
) |
"Destructive" version of DeterminizeLatticePhonePruned() where the input lattice might be changed.
Definition at line 1416 of file determinize-lattice-pruned.cc.
References DeterminizeLatticePrunedOptions::delta, DeterminizeLatticePhonePrunedOptions::delta, KALDI_VLOG, KALDI_WARN, DeterminizeLatticePrunedOptions::max_mem, DeterminizeLatticePhonePrunedOptions::max_mem, DeterminizeLatticePhonePrunedOptions::minimize, DeterminizeLatticePhonePrunedOptions::phone_determinize, and DeterminizeLatticePhonePrunedOptions::word_determinize.
Referenced by fst::DeterminizeLatticePhonePruned(), and DeterminizeLatticePhonePrunedOptions::Register().
bool DeterminizeLatticePhonePruned | ( | const kaldi::TransitionModel & | trans_model, |
const ExpandedFst< ArcTpl< Weight > > & | ifst, | ||
double | prune, | ||
MutableFst< ArcTpl< CompactLatticeWeightTpl< Weight, IntType > > > * | ofst, | ||
DeterminizeLatticePhonePrunedOptions | opts = DeterminizeLatticePhonePrunedOptions() |
||
) |
This function is a wrapper of DeterminizeLatticePhonePrunedFirstPass() and DeterminizeLatticePruned().
If –phone-determinize is set to true, it first calls DeterminizeLatticePhonePrunedFirstPass() to do the initial pass of determinization on the phone + word lattices. If –word-determinize is set true, it then does a second pass of determinization on the word lattices by calling DeterminizeLatticePruned(). If both are set to false, then it gives a warning and copying the lattices without determinization.
Note: the point of doing first a phone-level determinization pass and then a word-level determinization pass is that it allows us to determinize deeper lattices without "failing early" and returning a too-small lattice due to the max-mem constraint. The result should be the same as word-level determinization in general, but for deeper lattices it is a bit faster, despite the fact that we now have two passes of determinization by default.
Definition at line 1477 of file determinize-lattice-pruned.cc.
References fst::DeterminizeLatticePhonePruned().
bool DeterminizeLatticePhonePrunedWrapper | ( | const kaldi::TransitionModel & | trans_model, |
MutableFst< kaldi::LatticeArc > * | ifst, | ||
double | prune, | ||
MutableFst< kaldi::CompactLatticeArc > * | ofst, | ||
DeterminizeLatticePhonePrunedOptions | opts = DeterminizeLatticePhonePrunedOptions() |
||
) |
This function is a wrapper of DeterminizeLatticePhonePruned() that works for Lattice type FSTs.
It simplifies the calling process by calling TopSort() Invert() and ArcSort() for you. Unlike other determinization routines, the function requires "ifst" to have transition-id's on the input side and words on the output side. This function can be used as the top-level interface to all the determinization code.
Definition at line 1488 of file determinize-lattice-pruned.cc.
References KALDI_ERR.
Referenced by LatticeIncrementalDeterminizer::AcceptRawLatticeChunk(), kaldi::DecodeUtterance(), kaldi::DecodeUtteranceLatticeFaster(), kaldi::DecodeUtteranceLatticeSimple(), SingleUtteranceNnet3DecoderTpl< FST >::GetLattice(), SingleUtteranceNnet2Decoder::GetLattice(), SingleUtteranceGmmDecoder::GetLattice(), SingleUtteranceNnet2DecoderThreaded::GetLattice(), main(), DeterminizeLatticeTask::operator()(), DecodeUtteranceLatticeFasterClass::operator()(), NnetBatchDecoder::ProcessOutputUtterance(), and DeterminizeLatticePhonePrunedOptions::Register().
bool DeterminizeLatticePruned | ( | const ExpandedFst< ArcTpl< Weight > > & | ifst, |
double | beam, | ||
MutableFst< ArcTpl< CompactLatticeWeightTpl< Weight, IntType > > > * | ofst, | ||
DeterminizeLatticePrunedOptions | opts | ||
) |
Definition at line 1196 of file determinize-lattice-pruned.cc.
References LatticeDeterminizerPruned< Weight, IntType >::Determinize(), KALDI_ASSERT, KALDI_LOG, LatticeDeterminizerPruned< Weight, IntType >::Output(), kaldi::PruneLattice(), and DeterminizeLatticePrunedOptions::retry_cutoff.
Referenced by SingleUtteranceGmmDecoder::GetGaussianPosteriors(), LatticeSimpleDecoder::GetLattice(), LatticeBiglmFasterDecoder::GetLattice(), LatticeFasterDecoderTpl< fst::StdFst, decoder::BackpointerToken >::GetLattice(), main(), DeterminizeLatticeTask::operator()(), DeterminizeLatticePhonePrunedOptions::Register(), and kaldi::SentenceLevelConfidence().
bool DeterminizeLatticePruned | ( | const ExpandedFst< ArcTpl< Weight > > & | ifst, |
double | prune, | ||
MutableFst< ArcTpl< Weight > > * | ofst, | ||
DeterminizeLatticePrunedOptions | opts = DeterminizeLatticePrunedOptions() |
||
) |
This function implements the normal version of DeterminizeLattice, in which the output strings are represented using sequences of arcs, where all but the first one has an epsilon on the input side.
It also prunes using the beam in the "prune" parameter. The input FST must be topologically sorted in order for the algorithm to work. For efficiency it is recommended to sort ilabel as well. Returns true on success, and false if it had to terminate the determinization earlier than specified by the "prune" beam– that is, if it terminated because of the max_mem, max_loop or max_arcs constraints in the options. CAUTION: you may want to use the version below which outputs to CompactLattice.
Definition at line 1248 of file determinize-lattice-pruned.cc.
References LatticeDeterminizerPruned< Weight, IntType >::Determinize(), KALDI_ASSERT, KALDI_WARN, LatticeDeterminizerPruned< Weight, IntType >::Output(), kaldi::PruneLattice(), and DeterminizeLatticePrunedOptions::retry_cutoff.
bool DeterminizeStar | ( | F & | ifst, |
MutableFst< typename F::Arc > * | ofst, | ||
float | delta = kDelta , |
||
bool * | debug_ptr = NULL , |
||
int | max_states = -1 , |
||
bool | allow_partial = false |
||
) |
This function implements the normal version of DeterminizeStar, in which the output strings are represented using sequences of arcs, where all but the first one has an epsilon on the input side.
The debug_ptr argument is an optional pointer to a bool that, if it becomes true while the algorithm is executing, the algorithm will print a traceback and terminate (used in fstdeterminizestar.cc debug non-terminating determinization). If max_states is positive, it will stop determinization and throw an exception as soon as the max-states is reached. This can be useful in test. If allow_partial is true, the algorithm will output partial results when the specified max_states is reached (when larger than zero), instead of throwing out an error.
Caution, the return status is un-intuitive: this function will return false if determinization completed normally, and true if it was stopped early by reaching the 'max-states' limit, and a partial FST was generated.
Definition at line 625 of file determinize-star-inl.h.
References DeterminizerStar< F >::Determinize(), DeterminizerStar< F >::IsPartial(), and DeterminizerStar< F >::Output().
Referenced by fst::DeterminizeStarInLog(), kaldi::DoFactorMerging(), main(), kaldi::OptimizeFactorTransducer(), fst::SafeDeterminizeMinimizeWrapper(), fst::SafeDeterminizeWrapper(), fst::TestDeterminize(), fst::TestFactor(), and fst::TestMinimize().
bool DeterminizeStar | ( | F & | ifst, |
MutableFst< GallicArc< typename F::Arc > > * | ofst, | ||
float | delta, | ||
bool * | debug_ptr, | ||
int | max_states, | ||
bool | allow_partial | ||
) |
Definition at line 638 of file determinize-star-inl.h.
References DeterminizerStar< F >::Determinize(), DeterminizerStar< F >::EpsilonClosure::GetEpsilonClosure(), DeterminizerStar< F >::IsPartial(), and DeterminizerStar< F >::Output().