Public Member Functions | |
void | Advance (const CompactLatticeArc &arc, const PhoneAlignLatticeOptions &opts, LatticeWeight *weight) |
The state of the computation in which,. More... | |
bool | OutputPhoneArc (const TransitionModel &tmodel, const PhoneAlignLatticeOptions &opts, CompactLatticeArc *arc_out, bool *error) |
If it can output a whole phone, it will do so, will put it in arc_out, and return true; else it will return false. More... | |
bool | OutputWordArc (const TransitionModel &tmodel, const PhoneAlignLatticeOptions &opts, CompactLatticeArc *arc_out, bool *error) |
This will succeed (and output the arc) if we have >1 word in words_; the arc won't have any transition-ids on 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 TransitionModel &tmodel, const PhoneAlignLatticeOptions &opts, 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 33 of file phone-align-lattice.cc.
|
inline |
Definition at line 116 of file phone-align-lattice.cc.
|
inline |
Definition at line 117 of file phone-align-lattice.cc.
|
inline |
The state of the computation in which,.
along a single path in the lattice, we work out the phone boundaries and output phone-aligned arcs. [These may or may not have words on them; the word symbols are not aligned with anything. Advance the computation state by adding the symbols and weights from this arc. Gets rid of the weight and puts it in "weight" which will be put on the output arc; this keeps the state-space small.
Definition at line 42 of file phone-align-lattice.cc.
References LatticeWeightTpl< BaseFloat >::One(), LatticePhoneAligner::ComputationState::OutputPhoneArc(), LatticePhoneAligner::ComputationState::OutputWordArc(), PhoneAlignLatticeOptions::replace_output_symbols, fst::Times(), LatticePhoneAligner::ComputationState::transition_ids_, LatticePhoneAligner::ComputationState::weight_, and LatticePhoneAligner::ComputationState::word_labels_.
Referenced by LatticePhoneAligner::ProcessQueueElement().
|
inline |
FinalWeight() will return "weight" if both transition_ids and word_labels are empty, otherwise it will return Weight::Zero().
Definition at line 80 of file phone-align-lattice.cc.
References LatticePhoneAligner::ComputationState::IsEmpty(), LatticePhoneAligner::ComputationState::OutputArcForce(), LatticePhoneAligner::ComputationState::weight_, and LatticeWeightTpl< BaseFloat >::Zero().
Referenced by LatticePhoneAligner::ProcessFinal().
|
inline |
Definition at line 99 of file phone-align-lattice.cc.
References LatticePhoneAligner::ComputationState::transition_ids_, and LatticePhoneAligner::ComputationState::word_labels_.
Referenced by LatticePhoneAligner::TupleHash::operator()().
|
inline |
Definition at line 75 of file phone-align-lattice.cc.
References LatticePhoneAligner::ComputationState::transition_ids_, and LatticePhoneAligner::ComputationState::word_labels_.
Referenced by LatticePhoneAligner::ComputationState::FinalWeight(), LatticePhoneAligner::ComputationState::OutputArcForce(), and LatticePhoneAligner::ProcessFinal().
|
inline |
Definition at line 110 of file phone-align-lattice.cc.
References LatticePhoneAligner::ComputationState::transition_ids_, LatticePhoneAligner::ComputationState::weight_, and LatticePhoneAligner::ComputationState::word_labels_.
void OutputArcForce | ( | const TransitionModel & | tmodel, |
const PhoneAlignLatticeOptions & | opts, | ||
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 364 of file phone-align-lattice.cc.
References rnnlm::i, LatticePhoneAligner::ComputationState::IsEmpty(), TransitionModel::IsFinal(), KALDI_ASSERT, KALDI_WARN, LatticeWeightTpl< BaseFloat >::One(), PhoneAlignLatticeOptions::replace_output_symbols, LatticePhoneAligner::ComputationState::transition_ids_, TransitionModel::TransitionIdToPhone(), LatticePhoneAligner::ComputationState::weight_, and LatticePhoneAligner::ComputationState::word_labels_.
Referenced by LatticePhoneAligner::ComputationState::FinalWeight(), and LatticePhoneAligner::ProcessFinal().
bool OutputPhoneArc | ( | const TransitionModel & | tmodel, |
const PhoneAlignLatticeOptions & | opts, | ||
CompactLatticeArc * | arc_out, | ||
bool * | error | ||
) |
If it can output a whole phone, 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 will still output phone arcs, they will just be inaccurate. 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 295 of file phone-align-lattice.cc.
References rnnlm::i, TransitionModel::IsFinal(), TransitionModel::IsSelfLoop(), KALDI_WARN, LatticeWeightTpl< BaseFloat >::One(), PhoneAlignLatticeOptions::reorder, PhoneAlignLatticeOptions::replace_output_symbols, LatticePhoneAligner::ComputationState::transition_ids_, TransitionModel::TransitionIdToPhone(), LatticePhoneAligner::ComputationState::weight_, and LatticePhoneAligner::ComputationState::word_labels_.
Referenced by LatticePhoneAligner::ComputationState::Advance().
bool OutputWordArc | ( | const TransitionModel & | tmodel, |
const PhoneAlignLatticeOptions & | opts, | ||
CompactLatticeArc * | arc_out, | ||
bool * | error | ||
) |
This will succeed (and output the arc) if we have >1 word in words_; the arc won't have any transition-ids on it.
This is intended to fix a particular pathology where too many words were pending and we had blowup.
Definition at line 345 of file phone-align-lattice.cc.
References LatticeWeightTpl< BaseFloat >::One(), LatticePhoneAligner::ComputationState::weight_, and LatticePhoneAligner::ComputationState::word_labels_.
Referenced by LatticePhoneAligner::ComputationState::Advance().
|
private |
Definition at line 121 of file phone-align-lattice.cc.
Referenced by LatticePhoneAligner::ComputationState::Advance(), LatticePhoneAligner::ComputationState::Hash(), LatticePhoneAligner::ComputationState::IsEmpty(), LatticePhoneAligner::ComputationState::operator==(), LatticePhoneAligner::ComputationState::OutputArcForce(), and LatticePhoneAligner::ComputationState::OutputPhoneArc().
|
private |
Definition at line 123 of file phone-align-lattice.cc.
Referenced by LatticePhoneAligner::ComputationState::Advance(), LatticePhoneAligner::ComputationState::FinalWeight(), LatticePhoneAligner::ComputationState::operator==(), LatticePhoneAligner::ComputationState::OutputArcForce(), LatticePhoneAligner::ComputationState::OutputPhoneArc(), and LatticePhoneAligner::ComputationState::OutputWordArc().
|
private |
Definition at line 122 of file phone-align-lattice.cc.
Referenced by LatticePhoneAligner::ComputationState::Advance(), LatticePhoneAligner::ComputationState::Hash(), LatticePhoneAligner::ComputationState::IsEmpty(), LatticePhoneAligner::ComputationState::operator==(), LatticePhoneAligner::ComputationState::OutputArcForce(), LatticePhoneAligner::ComputationState::OutputPhoneArc(), and LatticePhoneAligner::ComputationState::OutputWordArc().