Public Member Functions | |
void | Advance (const CompactLatticeArc &arc, const TransitionModel &tmodel, LatticeWeight *leftover_weight) |
The state of the computation in which, along a single path in the lattice, we work out the word boundaries and output aligned arcs. More... | |
bool | ViableIfAdvanced (const ViabilityMap &viability_map) const |
Returns true if, assuming we were to add one or more phones by calling Advance one or more times on this, we might be able later to successfully call TakeTransition. More... | |
int32 | NumPhones () const |
int32 | NumWords () const |
int32 | PendingWord () const |
Freshness | WordFreshness () const |
Freshness | PhoneFreshness () const |
void | TakeForcedTransition (int32 partial_word_label, ComputationState *next_state, CompactLatticeArc *arc_out) const |
This may be called at the end of a lattice, if it was forced out. More... | |
bool | TakeTransition (const LexiconMap &lexicon_map, int32 word_id, int32 num_phones, ComputationState *next_state, CompactLatticeArc *arc_out) const |
Take a transition, if possible; consume "num_phones" phones and (if word_id != 0) the word "word_id" which must be the first word in words_. More... | |
bool | IsEmpty () const |
LatticeWeight | FinalWeight () const |
FinalWeight() will return "weight" if both transition_ids and word_labels are empty, otherwise it will return Weight::Zero(). More... | |
size_t | Hash () const |
bool | operator== (const ComputationState &other) const |
ComputationState () | |
ComputationState (const ComputationState &other) | |
Private Attributes | |
std::vector< int32 > | phones_ |
std::vector< int32 > | words_ |
Freshness | phone_fresh_ |
Freshness | word_fresh_ |
std::vector< std::vector< int32 > > | transition_ids_ |
LatticeWeight | weight_ |
Definition at line 62 of file word-align-lattice-lexicon.cc.
|
inline |
Definition at line 142 of file word-align-lattice-lexicon.cc.
|
inline |
Definition at line 145 of file word-align-lattice-lexicon.cc.
void Advance | ( | const CompactLatticeArc & | arc, |
const TransitionModel & | tmodel, | ||
LatticeWeight * | leftover_weight | ||
) |
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. Outputs weight to "leftover_weight" and sets the weight to 1.0 (this helps keep the state space small). Note: because we previously did PhoneAlignLattice, we can assume this arc corresponds to exactly one or zero phones.
Definition at line 573 of file word-align-lattice-lexicon.cc.
References KALDI_ASSERT, LatticeLexiconWordAligner::kFresh, LatticeLexiconWordAligner::kNotFresh, LatticeWeightTpl< BaseFloat >::One(), LatticeLexiconWordAligner::ComputationState::phone_fresh_, LatticeLexiconWordAligner::ComputationState::phones_, fst::Times(), LatticeLexiconWordAligner::ComputationState::transition_ids_, TransitionModel::TransitionIdToPhone(), LatticeLexiconWordAligner::ComputationState::weight_, LatticeLexiconWordAligner::ComputationState::word_fresh_, and LatticeLexiconWordAligner::ComputationState::words_.
Referenced by LatticeLexiconWordAligner::PossiblyAdvanceArc().
|
inline |
FinalWeight() will return "weight" if both transition_ids and word_labels are empty, otherwise it will return Weight::Zero().
Definition at line 112 of file word-align-lattice-lexicon.cc.
References LatticeLexiconWordAligner::ComputationState::IsEmpty(), LatticeLexiconWordAligner::ComputationState::weight_, and LatticeWeightTpl< BaseFloat >::Zero().
Referenced by LatticeLexiconWordAligner::ProcessFinal().
|
inline |
Definition at line 116 of file word-align-lattice-lexicon.cc.
References rnnlm::i, LatticeLexiconWordAligner::ComputationState::phone_fresh_, LatticeLexiconWordAligner::ComputationState::transition_ids_, LatticeLexiconWordAligner::ComputationState::word_fresh_, and LatticeLexiconWordAligner::ComputationState::words_.
Referenced by LatticeLexiconWordAligner::TupleHash::operator()().
|
inline |
Definition at line 107 of file word-align-lattice-lexicon.cc.
References LatticeLexiconWordAligner::ComputationState::transition_ids_, and LatticeLexiconWordAligner::ComputationState::words_.
Referenced by LatticeLexiconWordAligner::ComputationState::FinalWeight(), and LatticeLexiconWordAligner::ComputationState::TakeForcedTransition().
|
inline |
Definition at line 84 of file word-align-lattice-lexicon.cc.
References LatticeLexiconWordAligner::ComputationState::phones_.
Referenced by LatticeLexiconWordAligner::ProcessEpsilonTransitions(), and LatticeLexiconWordAligner::ProcessWordTransitions().
|
inline |
Definition at line 85 of file word-align-lattice-lexicon.cc.
References LatticeLexiconWordAligner::ComputationState::words_.
Referenced by LatticeLexiconWordAligner::ProcessWordTransitions().
|
inline |
Definition at line 132 of file word-align-lattice-lexicon.cc.
References LatticeLexiconWordAligner::ComputationState::phone_fresh_, LatticeLexiconWordAligner::ComputationState::transition_ids_, LatticeLexiconWordAligner::ComputationState::weight_, LatticeLexiconWordAligner::ComputationState::word_fresh_, and LatticeLexiconWordAligner::ComputationState::words_.
|
inline |
Definition at line 86 of file word-align-lattice-lexicon.cc.
References KALDI_ASSERT, and LatticeLexiconWordAligner::ComputationState::words_.
Referenced by LatticeLexiconWordAligner::ProcessWordTransitions().
|
inline |
Definition at line 88 of file word-align-lattice-lexicon.cc.
References LatticeLexiconWordAligner::ComputationState::phone_fresh_, LatticeLexiconWordAligner::ComputationState::TakeForcedTransition(), and LatticeLexiconWordAligner::ComputationState::TakeTransition().
Referenced by LatticeLexiconWordAligner::ProcessEpsilonTransitions(), and LatticeLexiconWordAligner::ProcessWordTransitions().
void TakeForcedTransition | ( | int32 | partial_word_label, |
ComputationState * | next_state, | ||
CompactLatticeArc * | arc_out | ||
) | const |
This may be called at the end of a lattice, if it was forced out.
Note: we will only use "partial_word_label" if there are phones without corresponding words; otherwise we'll use the word label that was there.
Definition at line 634 of file word-align-lattice-lexicon.cc.
References LatticeLexiconWordAligner::AppendVectors(), LatticeLexiconWordAligner::ComputationState::IsEmpty(), KALDI_ASSERT, KALDI_WARN, LatticeLexiconWordAligner::kFresh, LatticeWeightTpl< BaseFloat >::One(), LatticeLexiconWordAligner::ComputationState::phone_fresh_, LatticeLexiconWordAligner::ComputationState::phones_, LatticeLexiconWordAligner::ComputationState::transition_ids_, LatticeLexiconWordAligner::ComputationState::weight_, LatticeLexiconWordAligner::ComputationState::word_fresh_, and LatticeLexiconWordAligner::ComputationState::words_.
Referenced by LatticeLexiconWordAligner::ComputationState::PhoneFreshness(), and LatticeLexiconWordAligner::ProcessFinalForceOut().
bool TakeTransition | ( | const LexiconMap & | lexicon_map, |
int32 | word_id, | ||
int32 | num_phones, | ||
ComputationState * | next_state, | ||
CompactLatticeArc * | arc_out | ||
) | const |
Take a transition, if possible; consume "num_phones" phones and (if word_id != 0) the word "word_id" which must be the first word in words_.
Returns true if we could take the transition.
Definition at line 673 of file word-align-lattice-lexicon.cc.
References LatticeLexiconWordAligner::AppendVectors(), kaldi::GetVerboseLevel(), rnnlm::i, KALDI_ASSERT, KALDI_VLOG, LatticeLexiconWordAligner::kAllFresh, LatticeLexiconWordAligner::kFresh, LatticeLexiconWordAligner::kNotFresh, LatticeWeightTpl< BaseFloat >::One(), LatticeLexiconWordAligner::ComputationState::phone_fresh_, LatticeLexiconWordAligner::ComputationState::phones_, LatticeLexiconWordAligner::ComputationState::transition_ids_, LatticeLexiconWordAligner::ComputationState::weight_, LatticeLexiconWordAligner::ComputationState::word_fresh_, and LatticeLexiconWordAligner::ComputationState::words_.
Referenced by LatticeLexiconWordAligner::ComputationState::PhoneFreshness(), LatticeLexiconWordAligner::ProcessEpsilonTransitions(), and LatticeLexiconWordAligner::ProcessWordTransitions().
bool ViableIfAdvanced | ( | const ViabilityMap & | viability_map | ) | const |
Returns true if, assuming we were to add one or more phones by calling Advance one or more times on this, we might be able later to successfully call TakeTransition.
It's a kind of co-accessibility test that avoids us creating an exponentially large number of states that would contribute nothing to the final output.
Definition at line 604 of file word-align-lattice-lexicon.cc.
References LatticeLexiconWordAligner::ComputationState::phones_, and LatticeLexiconWordAligner::ComputationState::words_.
Referenced by LatticeLexiconWordAligner::PossiblyAdvanceArc().
|
inline |
Definition at line 87 of file word-align-lattice-lexicon.cc.
References LatticeLexiconWordAligner::ComputationState::word_fresh_.
Referenced by LatticeLexiconWordAligner::ProcessWordTransitions().
|
private |
Definition at line 159 of file word-align-lattice-lexicon.cc.
Referenced by LatticeLexiconWordAligner::ComputationState::Advance(), LatticeLexiconWordAligner::ComputationState::Hash(), LatticeLexiconWordAligner::ComputationState::operator==(), LatticeLexiconWordAligner::ComputationState::PhoneFreshness(), LatticeLexiconWordAligner::ComputationState::TakeForcedTransition(), and LatticeLexiconWordAligner::ComputationState::TakeTransition().
|
private |
Definition at line 150 of file word-align-lattice-lexicon.cc.
Referenced by LatticeLexiconWordAligner::ComputationState::Advance(), LatticeLexiconWordAligner::ComputationState::NumPhones(), LatticeLexiconWordAligner::ComputationState::TakeForcedTransition(), LatticeLexiconWordAligner::ComputationState::TakeTransition(), and LatticeLexiconWordAligner::ComputationState::ViableIfAdvanced().
|
private |
Definition at line 162 of file word-align-lattice-lexicon.cc.
Referenced by LatticeLexiconWordAligner::ComputationState::Advance(), LatticeLexiconWordAligner::ComputationState::Hash(), LatticeLexiconWordAligner::ComputationState::IsEmpty(), LatticeLexiconWordAligner::ComputationState::operator==(), LatticeLexiconWordAligner::ComputationState::TakeForcedTransition(), and LatticeLexiconWordAligner::ComputationState::TakeTransition().
|
private |
Definition at line 164 of file word-align-lattice-lexicon.cc.
Referenced by LatticeLexiconWordAligner::ComputationState::Advance(), LatticeLexiconWordAligner::ComputationState::FinalWeight(), LatticeLexiconWordAligner::ComputationState::operator==(), LatticeLexiconWordAligner::ComputationState::TakeForcedTransition(), and LatticeLexiconWordAligner::ComputationState::TakeTransition().
|
private |
Definition at line 160 of file word-align-lattice-lexicon.cc.
Referenced by LatticeLexiconWordAligner::ComputationState::Advance(), LatticeLexiconWordAligner::ComputationState::Hash(), LatticeLexiconWordAligner::ComputationState::operator==(), LatticeLexiconWordAligner::ComputationState::TakeForcedTransition(), LatticeLexiconWordAligner::ComputationState::TakeTransition(), and LatticeLexiconWordAligner::ComputationState::WordFreshness().
|
private |
Definition at line 151 of file word-align-lattice-lexicon.cc.
Referenced by LatticeLexiconWordAligner::ComputationState::Advance(), LatticeLexiconWordAligner::ComputationState::Hash(), LatticeLexiconWordAligner::ComputationState::IsEmpty(), LatticeLexiconWordAligner::ComputationState::NumWords(), LatticeLexiconWordAligner::ComputationState::operator==(), LatticeLexiconWordAligner::ComputationState::PendingWord(), LatticeLexiconWordAligner::ComputationState::TakeForcedTransition(), LatticeLexiconWordAligner::ComputationState::TakeTransition(), and LatticeLexiconWordAligner::ComputationState::ViableIfAdvanced().