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 784 of file lattice-weight.h.

Member Typedef Documentation

◆ Weight

typedef CompactLatticeWeightTpl<BaseWeightType, IntType> Weight

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

Member Function Documentation

◆ operator()()

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

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

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

788  {
789  // First find longest common prefix of the strings.
790  typename std::vector<IntType>::const_iterator s1b = w1.String().begin(),
791  s1e = w1.String().end(), s2b = w2.String().begin(), s2e = w2.String().end();
792  while (s1b < s1e && s2b < s2e && *s1b == *s2b) {
793  s1b++;
794  s2b++;
795  }
796  return Weight(Plus(w1.Weight(), w2.Weight()), std::vector<IntType>(w1.String().begin(), s1b));
797  }
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: