Home | History | Annotate | Download | only in fst

Lines Matching defs:Weight

41   // A final weight is mapped into a final weight. An error
45 // A final weight is mapped to an arc to the superfinal state
46 // when the result cannot be represented as a final weight.
50 // A final weight is mapped to an arc to the superfinal state
51 // unless the result can be represented as a final weight of weight
83 // // form A(0, 0, weight, kNoStateId).
114 typedef typename A::Weight Weight;
131 fst->SetFinal(superfinal, Weight::One());
150 fst->SetFinal(s, final_arc.weight);
160 fst->SetFinal(superfinal, Weight::One());
164 fst->SetFinal(s, Weight::Zero());
166 fst->SetFinal(s, final_arc.weight);
175 final_arc.weight != Weight::Zero())
177 final_arc.weight, superfinal));
178 fst->SetFinal(s, Weight::Zero());
202 typedef typename A::Weight Weight;
236 ofst->SetFinal(superfinal, B::Weight::One());
255 ofst->SetFinal(s, final_arc.weight);
264 ofst->SetFinal(superfinal, B::Weight::One());
268 ofst->SetFinal(s, B::Weight::Zero());
270 ofst->SetFinal(s, final_arc.weight);
277 final_arc.weight != B::Weight::Zero())
279 final_arc.weight, superfinal));
280 ofst->SetFinal(s, B::Weight::Zero());
329 typedef typename B::Weight Weight;
375 Weight Final(StateId s) {
386 SetFinal(s, final_arc.weight);
391 SetFinal(s, Weight::One());
396 SetFinal(s, final_arc.weight);
398 SetFinal(s, Weight::Zero());
403 SetFinal(s, s == superfinal_ ? Weight::One() : Weight::Zero());
458 if (!HasFinal(s) || Final(s) == Weight::Zero())
478 final_arc.weight != B::Weight::Zero())
480 final_arc.weight, superfinal_));
557 typedef typename B::Weight Weight;
725 // Mapper that leaves labels and nextstate unchanged and constructs a new weight
726 // from the underlying value of the arc weight. Requires that there is a
733 typedef typename FromArc::Weight FromWeight;
734 typedef typename ToArc::Weight ToWeight;
738 convert_weight_(arc.weight), arc.nextstate);
753 // Non-precision-changing weight conversions.
758 // Precision-changing weight conversions.
771 typedef typename A::Weight AW;
772 typedef typename GallicArc<A, S>::Weight GW;
776 if (arc.nextstate == kNoStateId && arc.weight != AW::Zero())
777 return ToArc(0, 0, GW(SW::One(), arc.weight), kNoStateId);
780 return ToArc(0, 0, GW(SW::Zero(), arc.weight), kNoStateId);
784 GW(SW::One(), arc.weight), arc.nextstate);
788 GW(SW(arc.olabel), arc.weight), arc.nextstate);
811 typedef typename A::Weight AW;
812 typedef typename GallicArc<A, S>::Weight GW;
819 if (arc.nextstate == kNoStateId && arc.weight == GW::Zero())
822 SW w1 = arc.weight.Value1();
823 AW w2 = arc.weight.Value2();
830 FSTERROR() << "FromGallicMapper: unrepesentable weight";
869 typedef typename A::Weight AW;
870 typedef typename GallicArc<A, S>::Weight GW;
891 if (arc.nextstate == kNoStateId && arc.weight == GW::Zero())
894 SW w1 = arc.weight.Value1();
895 AW w2 = arc.weight.Value2();
926 FSTERROR() << "GallicToNewSymbolMapper: unrepesentable weight";
974 typedef typename A::Weight Weight;
976 explicit PlusMapper(Weight w) : weight_(w) {}
979 if (arc.weight == Weight::Zero())
981 Weight w = Plus(arc.weight, weight_);
999 Weight weight_;
1008 typedef typename A::Weight Weight;
1010 explicit TimesMapper(Weight w) : weight_(w) {}
1013 if (arc.weight == Weight::Zero())
1015 Weight w = Times(arc.weight, weight_);
1030 Weight weight_;
1039 typedef typename A::Weight Weight;
1042 if (arc.weight == Weight::Zero())
1044 Weight w = Divide(Weight::One(), arc.weight);
1065 typedef typename FromArc::Weight FromWeight;
1066 typedef typename ToArc::Weight ToWeight;
1069 ToWeight w = arc.weight != FromWeight::Zero() ?
1091 typedef typename FromArc::Weight FromWeight;
1092 typedef typename ToArc::Weight ToWeight;
1099 ToWeight w = arc.weight.Quantize(delta_);
1119 // B::Weight = A::Weight::ReverseWeight
1122 // The weight is reversed, while the label and nextstate preserved
1130 return B(arc.ilabel, arc.olabel, arc.weight.Reverse(), arc.nextstate);