Public Member Functions | |
void | Advance (const CompactLatticeArc &arc, LatticeWeight *weight) |
The state of the computation in which,. More... | |
bool | OutputArc (const WordBoundaryInfo &info, const TransitionModel &tmodel, CompactLatticeArc *arc_out, bool *error) |
If it can output a whole word, it will do so, will put it in arc_out, and return true; else it will return false. More... | |
bool | OutputSilenceArc (const WordBoundaryInfo &info, const TransitionModel &tmodel, CompactLatticeArc *arc_out, bool *error) |
bool | OutputOnePhoneWordArc (const WordBoundaryInfo &info, const TransitionModel &tmodel, CompactLatticeArc *arc_out, bool *error) |
bool | OutputNormalWordArc (const WordBoundaryInfo &info, const TransitionModel &tmodel, CompactLatticeArc *arc_out, bool *error) |
This function tries to see if it can output a normal word arc– one with at least two phones in it. More... | |
bool | IsEmpty () |
LatticeWeight | FinalWeight () |
FinalWeight() will return "weight" if both transition_ids and word_labels are empty, otherwise it will return Weight::Zero(). More... | |
void | OutputArcForce (const WordBoundaryInfo &info, const TransitionModel &tmodel, CompactLatticeArc *arc_out, bool *error) |
This function may be called when you reach the end of the lattice and this structure hasn't voluntarily output words using "OutputArc". More... | |
size_t | Hash () const |
bool | operator== (const ComputationState &other) const |
ComputationState () | |
ComputationState (const ComputationState &other) | |
Private Attributes | |
std::vector< int32 > | transition_ids_ |
std::vector< int32 > | word_labels_ |
LatticeWeight | weight_ |
Definition at line 32 of file word-align-lattice.cc.
|
inline |
Definition at line 125 of file word-align-lattice.cc.
|
inline |
Definition at line 126 of file word-align-lattice.cc.
|
inline |
The state of the computation in which,.
along a single path in the lattice, we work out the word boundaries and output aligned arcs. Advance the computation state by adding the symbols and weights from this arc. We'll put the weight on the output arc; this helps keep the state-space smaller.
Definition at line 40 of file word-align-lattice.cc.
References LatticeWeightTpl< BaseFloat >::One(), fst::Times(), LatticeWordAligner::ComputationState::transition_ids_, LatticeWordAligner::ComputationState::weight_, and LatticeWordAligner::ComputationState::word_labels_.
Referenced by LatticeWordAligner::ProcessQueueElement().
|
inline |
FinalWeight() will return "weight" if both transition_ids and word_labels are empty, otherwise it will return Weight::Zero().
Definition at line 89 of file word-align-lattice.cc.
References LatticeWordAligner::ComputationState::IsEmpty(), LatticeWordAligner::ComputationState::OutputArcForce(), LatticeWordAligner::ComputationState::weight_, and LatticeWeightTpl< BaseFloat >::Zero().
Referenced by LatticeWordAligner::ProcessFinal().
|
inline |
Definition at line 108 of file word-align-lattice.cc.
References LatticeWordAligner::ComputationState::transition_ids_, and LatticeWordAligner::ComputationState::word_labels_.
Referenced by LatticeWordAligner::TupleHash::operator()().
|
inline |
Definition at line 84 of file word-align-lattice.cc.
References LatticeWordAligner::ComputationState::transition_ids_, and LatticeWordAligner::ComputationState::word_labels_.
Referenced by LatticeWordAligner::ComputationState::FinalWeight(), LatticeWordAligner::ComputationState::OutputArcForce(), and LatticeWordAligner::ProcessFinal().
|
inline |
Definition at line 119 of file word-align-lattice.cc.
References LatticeWordAligner::ComputationState::transition_ids_, LatticeWordAligner::ComputationState::weight_, and LatticeWordAligner::ComputationState::word_labels_.
|
inline |
If it can output a whole word, it will do so, will put it in arc_out, and return true; else it will return false.
If it detects an error condition and *error = false, it will set *error to true and print a warning. In this case it may or may not [output an arc and return true], depending on what we think is most likely the right thing to do. Of course once *error is set, something has gone wrong so don't trust the output too fully. Note: the "next_state" of the arc will not be set, you have to do that yourself.
Definition at line 59 of file word-align-lattice.cc.
References LatticeWordAligner::ComputationState::OutputNormalWordArc(), LatticeWordAligner::ComputationState::OutputOnePhoneWordArc(), and LatticeWordAligner::ComputationState::OutputSilenceArc().
void OutputArcForce | ( | const WordBoundaryInfo & | info, |
const TransitionModel & | tmodel, | ||
CompactLatticeArc * | arc_out, | ||
bool * | error | ||
) |
This function may be called when you reach the end of the lattice and this structure hasn't voluntarily output words using "OutputArc".
If IsEmpty() == false, then you can call this function and it will output an arc. The only non-error state in which this happens, is when a word (or silence) has ended, but we don't know that it's ended because we haven't seen the first transition-id from the next word. Otherwise (error state), the output will consist of partial words, and this will only happen for lattices that were somehow broken, i.e. had not reached the final state.
Definition at line 565 of file word-align-lattice.cc.
References rnnlm::i, LatticeWordAligner::ComputationState::IsEmpty(), TransitionModel::IsFinal(), kaldi::IsPlausibleWord(), TransitionModel::IsSelfLoop(), KALDI_ASSERT, KALDI_ERR, KALDI_WARN, WordBoundaryInfo::kNonWordPhone, LatticeWeightTpl< BaseFloat >::One(), WordBoundaryInfo::partial_word_label, WordBoundaryInfo::reorder, WordBoundaryInfo::silence_label, LatticeWordAligner::ComputationState::transition_ids_, TransitionModel::TransitionIdToPhone(), WordBoundaryInfo::TypeOfPhone(), LatticeWordAligner::ComputationState::weight_, and LatticeWordAligner::ComputationState::word_labels_.
Referenced by LatticeWordAligner::ComputationState::FinalWeight(), and LatticeWordAligner::ProcessFinal().
bool OutputNormalWordArc | ( | const WordBoundaryInfo & | info, |
const TransitionModel & | tmodel, | ||
CompactLatticeArc * | arc_out, | ||
bool * | error | ||
) |
This function tries to see if it can output a normal word arc– one with at least two phones in it.
Definition at line 450 of file word-align-lattice.cc.
References rnnlm::i, TransitionModel::IsFinal(), TransitionModel::IsSelfLoop(), KALDI_WARN, WordBoundaryInfo::kWordBeginPhone, WordBoundaryInfo::kWordEndPhone, WordBoundaryInfo::kWordInternalPhone, LatticeWeightTpl< BaseFloat >::One(), WordBoundaryInfo::reorder, LatticeWordAligner::ComputationState::transition_ids_, TransitionModel::TransitionIdToPhone(), WordBoundaryInfo::TypeOfPhone(), LatticeWordAligner::ComputationState::weight_, and LatticeWordAligner::ComputationState::word_labels_.
Referenced by LatticeWordAligner::ComputationState::OutputArc().
bool OutputOnePhoneWordArc | ( | const WordBoundaryInfo & | info, |
const TransitionModel & | tmodel, | ||
CompactLatticeArc * | arc_out, | ||
bool * | error | ||
) |
Definition at line 396 of file word-align-lattice.cc.
References rnnlm::i, TransitionModel::IsFinal(), TransitionModel::IsSelfLoop(), KALDI_WARN, WordBoundaryInfo::kWordBeginAndEndPhone, LatticeWeightTpl< BaseFloat >::One(), WordBoundaryInfo::reorder, LatticeWordAligner::ComputationState::transition_ids_, TransitionModel::TransitionIdToPhone(), WordBoundaryInfo::TypeOfPhone(), LatticeWordAligner::ComputationState::weight_, and LatticeWordAligner::ComputationState::word_labels_.
Referenced by LatticeWordAligner::ComputationState::OutputArc().
bool OutputSilenceArc | ( | const WordBoundaryInfo & | info, |
const TransitionModel & | tmodel, | ||
CompactLatticeArc * | arc_out, | ||
bool * | error | ||
) |
Definition at line 350 of file word-align-lattice.cc.
References rnnlm::i, TransitionModel::IsFinal(), TransitionModel::IsSelfLoop(), KALDI_WARN, WordBoundaryInfo::kNonWordPhone, LatticeWeightTpl< BaseFloat >::One(), WordBoundaryInfo::reorder, WordBoundaryInfo::silence_label, LatticeWordAligner::ComputationState::transition_ids_, TransitionModel::TransitionIdToPhone(), WordBoundaryInfo::TypeOfPhone(), and LatticeWordAligner::ComputationState::weight_.
Referenced by LatticeWordAligner::ComputationState::OutputArc().
|
private |
Definition at line 130 of file word-align-lattice.cc.
Referenced by LatticeWordAligner::ComputationState::Advance(), LatticeWordAligner::ComputationState::Hash(), LatticeWordAligner::ComputationState::IsEmpty(), LatticeWordAligner::ComputationState::operator==(), LatticeWordAligner::ComputationState::OutputArcForce(), LatticeWordAligner::ComputationState::OutputNormalWordArc(), LatticeWordAligner::ComputationState::OutputOnePhoneWordArc(), and LatticeWordAligner::ComputationState::OutputSilenceArc().
|
private |
Definition at line 132 of file word-align-lattice.cc.
Referenced by LatticeWordAligner::ComputationState::Advance(), LatticeWordAligner::ComputationState::FinalWeight(), LatticeWordAligner::ComputationState::operator==(), LatticeWordAligner::ComputationState::OutputArcForce(), LatticeWordAligner::ComputationState::OutputNormalWordArc(), LatticeWordAligner::ComputationState::OutputOnePhoneWordArc(), and LatticeWordAligner::ComputationState::OutputSilenceArc().
|
private |
Definition at line 131 of file word-align-lattice.cc.
Referenced by LatticeWordAligner::ComputationState::Advance(), LatticeWordAligner::ComputationState::Hash(), LatticeWordAligner::ComputationState::IsEmpty(), LatticeWordAligner::ComputationState::operator==(), LatticeWordAligner::ComputationState::OutputArcForce(), LatticeWordAligner::ComputationState::OutputNormalWordArc(), and LatticeWordAligner::ComputationState::OutputOnePhoneWordArc().