CompactLatticeWeightCommonDivisorTpl< BaseWeightType, IntType > Class Template Reference

#include <lattice-weight.h>

Public Types

typedef CompactLatticeWeightTpl< BaseWeightType, IntType > Weight
 

Public Member Functions

Weight operator() (const Weight &w1, const Weight &w2) const
 

Detailed Description

template<class BaseWeightType, class IntType>
class fst::CompactLatticeWeightCommonDivisorTpl< BaseWeightType, IntType >

Definition at line 785 of file lattice-weight.h.

Member Typedef Documentation

◆ Weight

typedef CompactLatticeWeightTpl<BaseWeightType, IntType> Weight

Definition at line 787 of file lattice-weight.h.

Member Function Documentation

◆ operator()()

Weight operator() ( const Weight w1,
const Weight w2 
) const
inline

Definition at line 789 of file lattice-weight.h.

References fst::Plus(), CompactLatticeWeightTpl< WeightType, IntType >::String(), and CompactLatticeWeightTpl< WeightType, IntType >::Weight().

789  {
790  // First find longest common prefix of the strings.
791  typename vector<IntType>::const_iterator s1b = w1.String().begin(),
792  s1e = w1.String().end(), s2b = w2.String().begin(), s2e = w2.String().end();
793  while (s1b < s1e && s2b < s2e && *s1b == *s2b) {
794  s1b++;
795  s2b++;
796  }
797  return Weight(Plus(w1.Weight(), w2.Weight()), vector<IntType>(w1.String().begin(), s1b));
798  }
LatticeWeightTpl< FloatType > Plus(const LatticeWeightTpl< FloatType > &w1, const LatticeWeightTpl< FloatType > &w2)
CompactLatticeWeightTpl< BaseWeightType, IntType > Weight

The documentation for this class was generated from the following file: