174 const StateId nextstate = arc.nextstate;
175 Weight total_removed = Weight::Zero(),
176 total_kept = Weight::Zero();
177 std::vector<Arc> arcs_to_add;
178 for (MutableArcIterator<MutableFst<Arc> > aiter_next(
fst_, nextstate);
181 Arc nextarc = aiter_next.Value();
189 aiter_next.SetValue(nextarc);
190 arcs_to_add.push_back(combined);
198 if (next_final != Weight::Zero()) {
202 if (
fst_->Final(s) == Weight::Zero())
206 fst_->SetFinal(nextstate, Weight::Zero());
213 if (total_removed != Weight::Zero()) {
214 if (total_kept == Weight::Zero()) {
222 Weight reweight =
Divide(total_kept, total, DIVIDE_LEFT);
227 for (
size_t i = 0;
i < arcs_to_add.size();
i++) {
230 fst_->AddArc(s, arcs_to_add[
i]);
LatticeWeightTpl< FloatType > Divide(const LatticeWeightTpl< FloatType > &w1, const LatticeWeightTpl< FloatType > &w2, DivideType typ=DIVIDE_ANY)
std::vector< StateId > num_arcs_out_
bool CanCombineArcs(const Arc &a, const Arc &b, Arc *c)
LatticeWeightTpl< FloatType > Plus(const LatticeWeightTpl< FloatType > &w1, const LatticeWeightTpl< FloatType > &w2)
std::vector< StateId > num_arcs_in_
void SetArc(StateId s, size_t pos, const Arc &arc)
ReweightPlus reweight_plus_
void Reweight(StateId s, size_t pos, Weight reweight)
static bool CanCombineFinal(const Arc &a, Weight final_prob, Weight *final_prob_out)