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

Member Typedef Documentation

typedef CompactLatticeWeightTpl<BaseWeightType, IntType> Weight

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

Member Function Documentation

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

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

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

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