Home | History | Annotate | Download | only in pdt

Lines Matching defs:Weight

80   typedef typename A::Weight Weight;
137 Weight Final(StateId s) {
140 Weight w = fst_->Final(tuple.state_id);
141 if (w != Weight::Zero() && tuple.stack_id == 0)
144 SetFinal(s, Weight::Zero());
232 typedef typename A::Weight Weight;
340 typedef typename A::Weight Weight;
378 // Expands and prunes with weight threshold 'threshold' the input PDT.
380 void Expand(MutableFst<A> *ofst, const Weight &threshold);
395 const vector<Weight> &d, const vector<Weight> &fd)
408 Weight w1 = (s1 < distance_.size()) && (s1 < fdistance_.size()) ?
409 Times(distance_[s1], fdistance_[s1]) : Weight::Zero();
410 Weight w2 = (s2 < distance_.size()) && (s2 < fdistance_.size()) ?
411 Times(distance_[s2], fdistance_[s2]) : Weight::Zero();
426 const vector<Weight> &distance_;
427 const vector<Weight> &fdistance_;
428 NaturalLess<Weight> less_;
438 const vector<Weight> &d, const vector<Weight> &fd)
445 Weight DistanceToDest(StateId state, StateId source) const;
448 Weight Distance(StateId s) const;
449 void SetDistance(StateId s, Weight w);
450 Weight FinalDistance(StateId s) const;
451 void SetFinalDistance(StateId s, Weight w);
455 void Relax(StateId s, const A &arc, Weight w);
471 vector<Weight> distance_; // Distance from initial state in efst_/ofst
472 vector<Weight> fdistance_; // Distance to final states in efst_/ofst
485 Weight limit_; // Weight limit
487 typedef unordered_map<StateId, Weight> DestMap;
499 slist<pair<StateId, Weight> > cached_dest_list_;
501 // states and weight to final states for source state
507 NaturalLess<Weight> less_;
544 // Returns the weight of the shortest balanced path from 'source' to 'dest'
547 typename A::Weight PrunedExpand<A>::DistanceToDest(StateId source,
572 typename A::Weight PrunedExpand<A>::Distance(StateId s) const {
573 return s < distance_.size() ? distance_[s] : Weight::Zero();
578 void PrunedExpand<A>::SetDistance(StateId s, Weight w) {
579 while (distance_.size() <= s ) distance_.push_back(Weight::Zero());
586 typename A::Weight PrunedExpand<A>::FinalDistance(StateId s) const {
587 return s < fdistance_.size() ? fdistance_[s] : Weight::Zero();
592 void PrunedExpand<A>::SetFinalDistance(StateId s, Weight w) {
593 while (fdistance_.size() <= s) fdistance_.push_back(Weight::Zero());
625 // * if the distance to 's' times the weight of 'arc' is smaller than
631 void PrunedExpand<A>::Relax(StateId s, const A &arc, Weight fd) {
632 Weight nd = Times(Distance(s), arc.weight);
649 Weight fd = Weight::Zero();
668 make_pair(rfst_.Start() -1, Weight::One()));
672 for (typename slist<pair<StateId, Weight> >::const_iterator iter =
682 Weight w = Times(Distance(s), Times(arc.weight, fd));
698 dest_map_[rfst_.Start() - 1] = Weight::One(); // not needed
703 make_pair(rfst_.Start() -1, Weight::One()));
706 SetFinalDistance(state_table_.FindState(tuple), Weight::One());
707 SetDistance(s, Weight::One());
716 Weight final = efst_.Final(s);
717 if ((final == Weight::Zero()) || less_(limit_, Times(Distance(s), final)))
727 << ", " << arc.ilabel << ":" << arc.olabel << " / " << arc.weight
756 Weight fd = Weight::Zero();
778 VLOG(2) << "Meta arc weight = " << arc.weight << " Times "
780 << " Times " << meta_arc.weight;
781 meta_arc.weight = Times(
782 arc.weight,
784 meta_arc.weight));
789 iter->second.weight),
796 s, keep_parentheses_ ? arc : Arc(0, 0, arc.weight, arc.nextstate));
798 Weight nd = Times(Distance(s), arc.weight);
815 Weight w = Times(Distance(s),
816 Times(arc.weight, FinalDistance(arc.nextstate)));
820 s, keep_parentheses_ ? arc : Arc(0, 0, arc.weight, arc.nextstate));
850 Weight dest_weight = Weight::Zero();
859 Times(arc.weight,
864 << si << " with weight " << dest_weight;
868 // Expands and prunes with weight threshold 'threshold' the input PDT.
872 MutableFst<A> *ofst, const typename A::Weight &threshold) {
918 typename Arc::Weight weight_threshold;
921 typename Arc::Weight w = Arc::Weight::Zero())
940 typedef typename Arc::Weight Weight;
945 if (opts.weight_threshold == Weight::Zero()) {