Home | History | Annotate | Download | only in lib

Lines Matching refs:potential

29 // Reweight FST according to the potentials defined by the POTENTIAL
34 // An arc of weight w, with an origin state of potential p and
35 // destination state of potential q, is reweighted by p\wq when
39 void Reweight(MutableFst<Arc> *fst, vector<typename Arc::Weight> potential,
45 while ( (int64)potential.size() < (int64)fst->NumStates())
46 potential.push_back(Weight::Zero());
66 if ((potential[state] == Weight::Zero()) ||
67 (potential[arc.nextstate] == Weight::Zero()))
70 && (potential[state] != Weight::Zero()))
71 arc.weight = Divide(Times(arc.weight, potential[arc.nextstate]),
72 potential[state], DIVIDE_LEFT);
74 && (potential[arc.nextstate] != Weight::Zero()))
75 arc.weight = Divide(Times(potential[state], arc.weight),
76 potential[arc.nextstate], DIVIDE_RIGHT);
80 && (potential[state] != Weight::Zero()))
82 Divide(fst->Final(state), potential[state], DIVIDE_LEFT));
84 fst->SetFinal(state, Times(potential[state], fst->Final(state)));
87 if ((potential[fst->Start()] != Weight::One()) &&
88 (potential[fst->Start()] != Weight::Zero())) {
96 arc.weight = Times(potential[state], arc.weight);
99 Divide(Weight::One(), potential[state], DIVIDE_RIGHT),
104 fst->SetFinal(state, Times(potential[state], fst->Final(state)));
106 fst->SetFinal(state, Times(Divide(Weight::One(), potential[state],
113 potential[fst->Start()] :
114 Divide(Weight::One(), potential[fst->Start()], DIVIDE_RIGHT);