Home | History | Annotate | Download | only in fst

Lines Matching defs:weight

35 // vector in the direction defined by TYPE. Weight needs to be left
39 // An arc of weight w, with an origin state of potential p and
45 const vector<typename Arc::Weight> &potential,
47 typedef typename Arc::Weight Weight;
52 if (type == REWEIGHT_TO_FINAL && !(Weight::Properties() & kRightSemiring)) {
54 << "Weight to be right distributive: "
55 << Weight::Type();
60 if (type == REWEIGHT_TO_INITIAL && !(Weight::Properties() & kLeftSemiring)) {
62 << "Weight to be left distributive: "
63 << Weight::Type();
73 typename Arc::Weight weight = potential[state];
74 if (weight != Weight::Zero()) {
81 typename Arc::Weight nextweight = potential[arc.nextstate];
82 if (nextweight == Weight::Zero())
85 arc.weight = Divide(Times(arc.weight, nextweight), weight,
88 arc.weight = Divide(Times(weight, arc.weight), nextweight,
93 fst->SetFinal(state, Divide(fst->Final(state), weight, DIVIDE_LEFT));
96 fst->SetFinal(state, Times(weight, fst->Final(state)));
103 fst->SetFinal(state, Times(Weight::Zero(), fst->Final(state)));
106 typename Arc::Weight startweight = fst->Start() < potential.size() ?
107 potential[fst->Start()] : Weight::Zero();
108 if ((startweight != Weight::One()) && (startweight != Weight::Zero())) {
116 arc.weight = Times(startweight, arc.weight);
118 arc.weight = Times(
119 Divide(Weight::One(), startweight, DIVIDE_RIGHT),
120 arc.weight);
126 fst->SetFinal(state, Times(Divide(Weight::One(), startweight,
131 Weight w = type == REWEIGHT_TO_INITIAL ? startweight :
132 Divide(Weight::One(), startweight, DIVIDE_RIGHT);