All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
CompactLatticeWeightCommonDivisorTpl< BaseWeightType, IntType > Class Template Reference

#include <lattice-weight.h>

Public Types

< BaseWeightType, IntType > 

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

Member Typedef Documentation

typedef CompactLatticeWeightTpl<BaseWeightType, IntType> Weight

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

Member Function Documentation

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

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

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

727  {
728  // First find longest common prefix of the strings.
729  typename vector<IntType>::const_iterator s1b = w1.String().begin(),
730  s1e = w1.String().end(), s2b = w2.String().begin(), s2e = w2.String().end();
731  while (s1b < s1e && s2b < s2e && *s1b == *s2b) {
732  s1b++;
733  s2b++;
734  }
735  return Weight(Plus(w1.Weight(), w2.Weight()), vector<IntType>(w1.String().begin(), s1b));
736  }
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: