Classes | |
class | ComputationState |
struct | Tuple |
struct | TupleEqual |
struct | TupleHash |
Public Types | |
enum | Freshness { kNotFresh, kFresh, kAllFresh } |
typedef CompactLatticeArc::StateId | StateId |
typedef CompactLatticeArc::Label | Label |
typedef WordAlignLatticeLexiconInfo::ViabilityMap | ViabilityMap |
typedef WordAlignLatticeLexiconInfo::LexiconMap | LexiconMap |
typedef WordAlignLatticeLexiconInfo::NumPhonesMap | NumPhonesMap |
typedef unordered_map< Tuple, StateId, TupleHash, TupleEqual > | MapType |
Public Member Functions | |
StateId | GetStateForTuple (const Tuple &tuple) |
void | ProcessTransition (StateId prev_output_state, const Tuple &next_tuple, CompactLatticeArc *arc) |
void | ProcessEpsilonTransitions (const Tuple &tuple, StateId output_state) |
void | ProcessWordTransitions (const Tuple &tuple, StateId output_state) |
void | PossiblyAdvanceArc (const Tuple &tuple, StateId output_state) |
bool | ProcessFinal () |
Process all final-probs (normal case, no forcing-out). More... | |
bool | HasNonEpsArcsOut (StateId output_state) |
This function returns true if the state "output_state" in the output lattice has arcs out that have either a non-epsilon symbol or transition-ids in the string of the weight. More... | |
void | ProcessFinalForceOut () |
Creates arcs from all the tuples that were final in the original lattice but have no arcs out of them in the output lattice that consume words or phones– does so by "forcing out" any words and phones there are pending in the computation states. More... | |
void | ProcessFinalWrapper () |
void | ProcessQueueElement () |
LatticeLexiconWordAligner (const CompactLattice &lat, const TransitionModel &tmodel, const WordAlignLatticeLexiconInfo &lexicon_info, int32 max_states, int32 partial_word_label, CompactLattice *lat_out) | |
void | RemoveEpsilonsFromLattice () |
bool | AlignLattice () |
Static Public Member Functions | |
static void | AppendVectors (std::vector< std::vector< int32 > >::const_iterator input_begin, std::vector< std::vector< int32 > >::const_iterator input_end, std::vector< int32 > *output) |
Public Attributes | |
CompactLattice | lat_in_ |
const TransitionModel & | tmodel_ |
const WordAlignLatticeLexiconInfo & | lexicon_info_ |
int32 | max_states_ |
CompactLattice * | lat_out_ |
std::vector< std::pair< Tuple, StateId > > | queue_ |
std::vector< std::pair< Tuple, StateId > > | final_queue_ |
MapType | map_ |
int32 | partial_word_label_ |
bool | error_ |
Definition at line 35 of file word-align-lattice-lexicon.cc.
typedef CompactLatticeArc::Label Label |
Definition at line 38 of file word-align-lattice-lexicon.cc.
Definition at line 40 of file word-align-lattice-lexicon.cc.
typedef unordered_map<Tuple, StateId, TupleHash, TupleEqual> MapType |
Definition at line 195 of file word-align-lattice-lexicon.cc.
Definition at line 41 of file word-align-lattice-lexicon.cc.
typedef CompactLatticeArc::StateId StateId |
Definition at line 37 of file word-align-lattice-lexicon.cc.
Definition at line 39 of file word-align-lattice-lexicon.cc.
enum Freshness |
|
inline |
Definition at line 285 of file word-align-lattice-lexicon.cc.
References fst::CreateSuperFinal(), and LatticeLexiconWordAligner::lat_in_.
|
inline |
Definition at line 317 of file word-align-lattice-lexicon.cc.
References LatticeLexiconWordAligner::error_, LatticeLexiconWordAligner::GetStateForTuple(), KALDI_WARN, LatticeLexiconWordAligner::lat_in_, LatticeLexiconWordAligner::lat_out_, LatticeLexiconWordAligner::max_states_, LatticeLexiconWordAligner::ProcessFinalWrapper(), LatticeLexiconWordAligner::ProcessQueueElement(), LatticeLexiconWordAligner::queue_, and LatticeLexiconWordAligner::RemoveEpsilonsFromLattice().
Referenced by kaldi::WordAlignLatticeLexicon().
|
static |
Definition at line 363 of file word-align-lattice-lexicon.cc.
Referenced by LatticeLexiconWordAligner::ComputationState::TakeForcedTransition(), and LatticeLexiconWordAligner::ComputationState::TakeTransition().
Definition at line 198 of file word-align-lattice-lexicon.cc.
References LatticeLexiconWordAligner::lat_out_, LatticeLexiconWordAligner::map_, and LatticeLexiconWordAligner::queue_.
Referenced by LatticeLexiconWordAligner::AlignLattice(), LatticeLexiconWordAligner::PossiblyAdvanceArc(), LatticeLexiconWordAligner::ProcessFinalForceOut(), and LatticeLexiconWordAligner::ProcessTransition().
This function returns true if the state "output_state" in the output lattice has arcs out that have either a non-epsilon symbol or transition-ids in the string of the weight.
Definition at line 531 of file word-align-lattice-lexicon.cc.
References LatticeLexiconWordAligner::lat_out_.
Referenced by LatticeLexiconWordAligner::ProcessFinalForceOut(), and LatticeLexiconWordAligner::ProcessTransition().
Definition at line 488 of file word-align-lattice-lexicon.cc.
References LatticeLexiconWordAligner::ComputationState::Advance(), LatticeLexiconWordAligner::Tuple::comp_state, LatticeLexiconWordAligner::GetStateForTuple(), LatticeLexiconWordAligner::Tuple::input_state, LatticeLexiconWordAligner::lat_in_, LatticeLexiconWordAligner::lat_out_, LatticeLexiconWordAligner::lexicon_info_, LatticeLexiconWordAligner::tmodel_, WordAlignLatticeLexiconInfo::viability_map_, and LatticeLexiconWordAligner::ComputationState::ViableIfAdvanced().
Referenced by LatticeLexiconWordAligner::ProcessQueueElement(), and LatticeLexiconWordAligner::ProcessTransition().
Definition at line 380 of file word-align-lattice-lexicon.cc.
References LatticeLexiconWordAligner::Tuple::comp_state, LatticeLexiconWordAligner::Tuple::input_state, KALDI_ERR, LatticeLexiconWordAligner::kAllFresh, LatticeLexiconWordAligner::kFresh, LatticeLexiconWordAligner::lexicon_info_, WordAlignLatticeLexiconInfo::lexicon_map_, WordAlignLatticeLexiconInfo::num_phones_map_, LatticeLexiconWordAligner::ComputationState::NumPhones(), LatticeLexiconWordAligner::ComputationState::PhoneFreshness(), LatticeLexiconWordAligner::ProcessTransition(), and LatticeLexiconWordAligner::ComputationState::TakeTransition().
Referenced by LatticeLexiconWordAligner::ProcessQueueElement(), and LatticeLexiconWordAligner::ProcessTransition().
bool ProcessFinal | ( | ) |
Process all final-probs (normal case, no forcing-out).
returns true if we had at least one final-prob.
Definition at line 511 of file word-align-lattice-lexicon.cc.
References LatticeLexiconWordAligner::Tuple::comp_state, LatticeLexiconWordAligner::final_queue_, LatticeLexiconWordAligner::ComputationState::FinalWeight(), rnnlm::i, LatticeLexiconWordAligner::Tuple::input_state, KALDI_ASSERT, LatticeLexiconWordAligner::lat_in_, LatticeLexiconWordAligner::lat_out_, CompactLatticeWeightTpl< WeightType, IntType >::One(), and LatticeWeightTpl< BaseFloat >::Zero().
Referenced by LatticeLexiconWordAligner::ProcessFinalWrapper(), and LatticeLexiconWordAligner::ProcessTransition().
void ProcessFinalForceOut | ( | ) |
Creates arcs from all the tuples that were final in the original lattice but have no arcs out of them in the output lattice that consume words or phones– does so by "forcing out" any words and phones there are pending in the computation states.
This function is only called if no states were "naturally" final; this will only happen for lattices that were forced out during decoding.
Definition at line 541 of file word-align-lattice-lexicon.cc.
References LatticeLexiconWordAligner::Tuple::comp_state, LatticeLexiconWordAligner::final_queue_, LatticeLexiconWordAligner::GetStateForTuple(), LatticeLexiconWordAligner::HasNonEpsArcsOut(), rnnlm::i, LatticeLexiconWordAligner::Tuple::input_state, KALDI_ASSERT, LatticeLexiconWordAligner::lat_out_, LatticeLexiconWordAligner::partial_word_label_, LatticeLexiconWordAligner::queue_, kaldi::swap(), and LatticeLexiconWordAligner::ComputationState::TakeForcedTransition().
Referenced by LatticeLexiconWordAligner::ProcessFinalWrapper(), and LatticeLexiconWordAligner::ProcessTransition().
|
inline |
Definition at line 250 of file word-align-lattice-lexicon.cc.
References LatticeLexiconWordAligner::error_, LatticeLexiconWordAligner::final_queue_, KALDI_WARN, LatticeLexiconWordAligner::ProcessFinal(), and LatticeLexiconWordAligner::ProcessFinalForceOut().
Referenced by LatticeLexiconWordAligner::AlignLattice().
|
inline |
Definition at line 268 of file word-align-lattice-lexicon.cc.
References LatticeLexiconWordAligner::final_queue_, KALDI_ASSERT, LatticeLexiconWordAligner::lat_in_, LatticeLexiconWordAligner::PossiblyAdvanceArc(), LatticeLexiconWordAligner::ProcessEpsilonTransitions(), LatticeLexiconWordAligner::ProcessWordTransitions(), LatticeLexiconWordAligner::queue_, and CompactLatticeWeightTpl< WeightType, IntType >::Zero().
Referenced by LatticeLexiconWordAligner::AlignLattice().
|
inline |
Definition at line 211 of file word-align-lattice-lexicon.cc.
References LatticeLexiconWordAligner::GetStateForTuple(), LatticeLexiconWordAligner::HasNonEpsArcsOut(), LatticeLexiconWordAligner::lat_out_, LatticeLexiconWordAligner::PossiblyAdvanceArc(), LatticeLexiconWordAligner::ProcessEpsilonTransitions(), LatticeLexiconWordAligner::ProcessFinal(), LatticeLexiconWordAligner::ProcessFinalForceOut(), and LatticeLexiconWordAligner::ProcessWordTransitions().
Referenced by LatticeLexiconWordAligner::ProcessEpsilonTransitions(), and LatticeLexiconWordAligner::ProcessWordTransitions().
Definition at line 439 of file word-align-lattice-lexicon.cc.
References LatticeLexiconWordAligner::Tuple::comp_state, LatticeLexiconWordAligner::Tuple::input_state, KALDI_ERR, LatticeLexiconWordAligner::kAllFresh, LatticeLexiconWordAligner::kFresh, LatticeLexiconWordAligner::lexicon_info_, WordAlignLatticeLexiconInfo::lexicon_map_, WordAlignLatticeLexiconInfo::num_phones_map_, LatticeLexiconWordAligner::ComputationState::NumPhones(), LatticeLexiconWordAligner::ComputationState::NumWords(), LatticeLexiconWordAligner::ComputationState::PendingWord(), LatticeLexiconWordAligner::ComputationState::PhoneFreshness(), LatticeLexiconWordAligner::ProcessTransition(), LatticeLexiconWordAligner::ComputationState::TakeTransition(), and LatticeLexiconWordAligner::ComputationState::WordFreshness().
Referenced by LatticeLexiconWordAligner::ProcessQueueElement(), and LatticeLexiconWordAligner::ProcessTransition().
|
inline |
Definition at line 308 of file word-align-lattice-lexicon.cc.
References LatticeLexiconWordAligner::lat_out_, and fst::RemoveSomeInputSymbols().
Referenced by LatticeLexiconWordAligner::AlignLattice().
bool error_ |
Definition at line 359 of file word-align-lattice-lexicon.cc.
Referenced by LatticeLexiconWordAligner::AlignLattice(), and LatticeLexiconWordAligner::ProcessFinalWrapper().
Definition at line 353 of file word-align-lattice-lexicon.cc.
Referenced by LatticeLexiconWordAligner::ProcessFinal(), LatticeLexiconWordAligner::ProcessFinalForceOut(), LatticeLexiconWordAligner::ProcessFinalWrapper(), and LatticeLexiconWordAligner::ProcessQueueElement().
CompactLattice lat_in_ |
Definition at line 345 of file word-align-lattice-lexicon.cc.
Referenced by LatticeLexiconWordAligner::AlignLattice(), LatticeLexiconWordAligner::LatticeLexiconWordAligner(), LatticeLexiconWordAligner::PossiblyAdvanceArc(), LatticeLexiconWordAligner::ProcessFinal(), and LatticeLexiconWordAligner::ProcessQueueElement().
CompactLattice* lat_out_ |
Definition at line 349 of file word-align-lattice-lexicon.cc.
Referenced by LatticeLexiconWordAligner::AlignLattice(), LatticeLexiconWordAligner::GetStateForTuple(), LatticeLexiconWordAligner::HasNonEpsArcsOut(), LatticeLexiconWordAligner::PossiblyAdvanceArc(), LatticeLexiconWordAligner::ProcessFinal(), LatticeLexiconWordAligner::ProcessFinalForceOut(), LatticeLexiconWordAligner::ProcessTransition(), and LatticeLexiconWordAligner::RemoveEpsilonsFromLattice().
const WordAlignLatticeLexiconInfo& lexicon_info_ |
Definition at line 347 of file word-align-lattice-lexicon.cc.
Referenced by LatticeLexiconWordAligner::PossiblyAdvanceArc(), LatticeLexiconWordAligner::ProcessEpsilonTransitions(), and LatticeLexiconWordAligner::ProcessWordTransitions().
MapType map_ |
Definition at line 357 of file word-align-lattice-lexicon.cc.
Referenced by LatticeLexiconWordAligner::GetStateForTuple().
int32 max_states_ |
Definition at line 348 of file word-align-lattice-lexicon.cc.
Referenced by LatticeLexiconWordAligner::AlignLattice().
int32 partial_word_label_ |
Definition at line 358 of file word-align-lattice-lexicon.cc.
Referenced by LatticeLexiconWordAligner::ProcessFinalForceOut().
Definition at line 351 of file word-align-lattice-lexicon.cc.
Referenced by LatticeLexiconWordAligner::AlignLattice(), LatticeLexiconWordAligner::GetStateForTuple(), LatticeLexiconWordAligner::ProcessFinalForceOut(), and LatticeLexiconWordAligner::ProcessQueueElement().
const TransitionModel& tmodel_ |
Definition at line 346 of file word-align-lattice-lexicon.cc.
Referenced by LatticeLexiconWordAligner::PossiblyAdvanceArc().