public static <TK,FV>FeatureValueCollection<FV> combine(Derivation<TK,FV> hyp){
  Counter<FV> counter=new ClassicCounter<FV>();
  for (; hyp != null; hyp=hyp.parent) {
    if (hyp.features != null) {
      for (      FeatureValue<FV> feature : hyp.features) {
        counter.incrementCount(feature.name,feature.value);
      }
    }
  }
  Set<FV> featureNames=new TreeSet<FV>(counter.keySet());
  FeatureValueCollection<FV> combinedList=new FeatureValueList<FV>(featureNames.size());
  for (  FV feature : featureNames) {
    combinedList.add(new FeatureValue<FV>(feature,counter.getCount(feature)));
  }
  return combinedList;
}

public static < TK , FV > FeatureValueCollection < FV > combine ( Derivation < TK , FV > hyp ) { Counter < FV > counter = new ClassicCounter < FV > ( ) ; for ( ; hyp != null ; hyp = hyp . parent ) { if ( hyp . features != null ) { for ( FeatureValue < FV > feature : hyp . features ) { counter . incrementCount ( feature . name , feature . value ) ; } } } Set < FV > featureNames = new TreeSet < FV > ( counter . keySet ( ) ) ; FeatureValueCollection < FV > combinedList = new FeatureValueList < FV > ( featureNames . size ( ) ) ; for ( FV feature : featureNames ) { combinedList . add ( new FeatureValue < FV > ( feature , counter . getCount ( feature ) ) ) ; } return combinedList ; }
aggregate feature values stored in a chain of hypotheses .
