Definition at line 734 of file word-align-lattice.cc.
◆ WordAlignedLatticeTester()
Definition at line 736 of file word-align-lattice.cc.
const WordBoundaryInfo & info_
const CompactLattice & aligned_lat_
const CompactLattice & lat_
const TransitionModel & tmodel_
◆ Test()
◆ TestArc()
Definition at line 758 of file word-align-lattice.cc.
References KALDI_ERR.
761 KALDI_ERR <<
"Invalid arc in aligned CompactLattice: " 762 << arc.ilabel <<
" " << arc.olabel <<
" " << arc.nextstate
763 <<
" " << arc.weight;
bool TestArcNormalWord(const CompactLatticeArc &arc)
bool TestArcOnePhoneWord(const CompactLatticeArc &arc)
bool TestArcEmpty(const CompactLatticeArc &arc)
bool TestArcSilence(const CompactLatticeArc &arc)
◆ TestArcEmpty()
Definition at line 765 of file word-align-lattice.cc.
766 if (arc.ilabel != 0)
return false;
767 const std::vector<int32> &tids = arc.weight.String();
◆ TestArcNormalWord()
Definition at line 828 of file word-align-lattice.cc.
References rnnlm::i, LatticeWordAligner::info_, TransitionModel::IsFinal(), TransitionModel::IsSelfLoop(), rnnlm::j, WordBoundaryInfo::kWordBeginPhone, WordBoundaryInfo::kWordEndPhone, WordBoundaryInfo::kWordInternalPhone, WordBoundaryInfo::reorder, LatticeWordAligner::tmodel_, TransitionModel::TransitionIdToPhone(), TransitionModel::TransitionIdToTransitionState(), and WordBoundaryInfo::TypeOfPhone().
829 if (arc.ilabel == 0)
return false;
830 const std::vector<int32> &tids = arc.weight.String();
831 if (tids.empty())
return false;
838 for (i = 0; i < tids.size(); i++) {
847 while (i < tids.size() &&
852 if (i == tids.size())
return false;
856 for (
size_t j = i;
j < tids.size();
j++)
860 for (
size_t j = i; j < tids.size(); j++) {
867 for (
size_t k = j + 1; k < tids.size(); k++)
const WordBoundaryInfo & info_
PhoneType TypeOfPhone(int32 p) const
bool IsSelfLoop(int32 trans_id) const
int32 TransitionIdToTransitionState(int32 trans_id) const
bool IsFinal(int32 trans_id) const
int32 TransitionIdToPhone(int32 trans_id) const
const TransitionModel & tmodel_
◆ TestArcOnePhoneWord()
◆ TestArcPartialWord()
◆ TestArcSilence()
Definition at line 770 of file word-align-lattice.cc.
References rnnlm::i, LatticeWordAligner::info_, TransitionModel::IsFinal(), rnnlm::j, WordBoundaryInfo::kNonWordPhone, WordBoundaryInfo::reorder, WordBoundaryInfo::silence_label, LatticeWordAligner::tmodel_, TransitionModel::TransitionIdToPhone(), TransitionModel::TransitionIdToTransitionState(), and WordBoundaryInfo::TypeOfPhone().
774 const std::vector<int32> &tids = arc.weight.String();
775 if (tids.empty())
return false;
779 for (
size_t i = 0;
i < tids.size();
i++)
784 for (
size_t i = 0; i < tids.size(); i++) {
789 for (
size_t j = i+1;
j < tids.size();
j++) {
const WordBoundaryInfo & info_
PhoneType TypeOfPhone(int32 p) const
int32 TransitionIdToTransitionState(int32 trans_id) const
bool IsFinal(int32 trans_id) const
int32 TransitionIdToPhone(int32 trans_id) const
const TransitionModel & tmodel_
◆ TestEquivalent()
Definition at line 891 of file word-align-lattice.cc.
References LatticeWordAligner::info_, KALDI_ERR, LatticeWordAligner::lat_, kaldi::Rand(), fst::RemoveSomeInputSymbols(), and WordBoundaryInfo::silence_label.
894 std::vector<int32> to_remove;
897 Project(&aligned_lat, fst::PROJECT_INPUT);
900 if (!RandEquivalent(
lat_, aligned_lat, 5, 1.0e+10,
Rand(),
902 KALDI_ERR <<
"Equivalence test failed (testing word-alignment of lattices.) " 903 <<
"Make sure your model and lattices match!";
const WordBoundaryInfo & info_
const CompactLattice & aligned_lat_
int Rand(struct RandomState *state)
fst::VectorFst< CompactLatticeArc > CompactLattice
const CompactLattice & lat_
void RemoveSomeInputSymbols(const std::vector< I > &to_remove, MutableFst< Arc > *fst)
RemoveSomeInputSymbols removes any symbol that appears in "to_remove", from the input side of the FST...
◆ TestFinal()
◆ aligned_lat_
◆ info_
◆ lat_
◆ tmodel_
The documentation for this class was generated from the following file: