Lines Matching refs:Weight
39 #include <fst/factor-weight.h>
57 typedef W Weight;
70 typedef StringWeight<L, S> Weight;
72 Weight operator()(const Weight &w1, const Weight &w2) const {
77 FSTERROR() << "LabelCommonDivisor: Weight needs to be left semiring";
78 return Weight::NoWeight();
80 return Weight::One();
81 } else if (w1 == Weight::Zero()) {
82 return Weight(iter2.Value());
83 } else if (w2 == Weight::Zero()) {
84 return Weight(iter1.Value());
86 return Weight(iter1.Value());
88 return Weight::One();
96 // weight component, which defaults to the default common divisor.
100 typedef GallicWeight<L, W, S> Weight;
102 Weight operator()(const Weight &w1, const Weight &w2) const {
103 return Weight(label_common_divisor_(w1.Value1(), w2.Value1()),
117 typedef typename A::Weight Weight;
121 DeterminizeElement(StateId s, Weight w) : state_id(s), weight(w) {}
124 return state_id == element.state_id && weight == element.weight;
129 (state_id == element.state_id && weight == element.weight);
133 Weight weight; // Residual weight
196 typedef typename Arc::Weight Weight;
271 if (!element1 || element1->weight != element2.weight) {
303 hash ^= n << lshift ^ n >> rshift ^ element.weight.Hash();
326 class D = DefaultCommonDivisor<typename Arc::Weight>,
369 typedef typename A::Weight Weight;
409 Weight Final(StateId s) {
411 Weight final = ComputeFinal(s);
445 virtual Weight ComputeFinal(StateId s) = 0;
466 typedef typename A::Weight Weight;
473 const vector<Weight> *in_dist, vector<Weight> *out_dist,
485 if (!(Weight::Properties() & kLeftSemiring)) {
486 FSTERROR() << "DeterminizeFst: Weight needs to be left distributive: "
487 << Weight::Type();
529 Element element(s, Weight::One());
535 virtual Weight ComputeFinal(StateId s) {
537 Weight final = Weight::Zero();
542 final = Plus(final, Times(element.weight,
559 Weight ComputeDistance(const Subset *subset) {
560 Weight outd = Weight::Zero();
564 Weight ind = element.state_id < in_dist_->size() ?
565 (*in_dist_)[element.state_id] : Weight::Zero();
566 outd = Plus(outd, Times(element.weight, ind));
601 Times(src_element.weight, arc.weight));
627 arc.weight = Weight::Zero();
633 // Computes label weight.
634 arc.weight = common_divisor_(arc.weight, dest_element.weight);
640 // Found duplicate state: sums state weight and deletes dup.
641 matching_element->weight = Plus(matching_element->weight,
642 dest_element.weight);
643 if (!matching_element->weight.Member())
655 // Divides out label weight from destination subset elements.
662 dest_element.weight = Divide(dest_element.weight, arc.weight,
664 dest_element.weight = dest_element.weight.Quantize(delta_);
673 const vector<Weight> *in_dist_; // Distance to final NFA states
674 vector<Weight> *out_dist_; // Distance to final DFA states
700 typedef typename A::Weight Weight;
710 typedef GallicCommonDivisor<Label, Weight, S, D> CommonDivisor;
711 typedef GallicFactor<Label, Weight, S> FactorIterator;
746 virtual Weight ComputeFinal(StateId s) { return from_fst_->Final(s); }
800 typedef typename A::Weight Weight;
809 typedef DefaultCommonDivisor<Weight> D;
841 const vector<Weight> *in_dist, vector<Weight> *out_dist,
945 typedef typename Arc::Weight Weight;
949 Weight weight_threshold; // Pruning weight threshold.
954 explicit DeterminizeOptions(float d = kDelta, Weight w = Weight::Zero(),
984 typedef typename Arc::Weight Weight;
992 if (opts.weight_threshold != Weight::Zero() ||
995 vector<Weight> idistance, odistance;