com.aliasi.features
Class BoundedFeatureExtractor<E>

java.lang.Object
  extended by com.aliasi.features.FeatureExtractorFilter<E>
      extended by com.aliasi.features.ModifiedFeatureExtractor<E>
          extended by com.aliasi.features.BoundedFeatureExtractor<E>
Type Parameters:
E - The type of objects whose features are extracted.
All Implemented Interfaces:
FeatureExtractor<E>, Serializable

public class BoundedFeatureExtractor<E>
extends ModifiedFeatureExtractor<E>
implements Serializable

A BoundedFeatureExtractor provides a lower-bound and upper-bound on feature values between which all values from a contained base extractor are bounded. Values greater than the upper bound are replaced with the upper bound, and values less than the lower bound are replaced with the lower bound. Values may be unbounded below by using Double.NEGATIVE_INFINITY as the lower bound, and may be unbounded above by using Double.POSITIVE_INFINITY the upper bound.

Since:
Lingpipe3.8
Version:
3.8
Author:
Mike Ross, Bob Carpenter
See Also:
Serialized Form

Constructor Summary
BoundedFeatureExtractor(FeatureExtractor<? super E> extractor, double minValue, double maxValue)
          Construct a bounded feature extractor that bounds the feature values produced by the specified extractor to be within the specified minimum and maximum values.
 
Method Summary
 Number filter(String feature, Number value)
          Return the bounded value corresponding to the specified value.
 
Methods inherited from class com.aliasi.features.ModifiedFeatureExtractor
features
 
Methods inherited from class com.aliasi.features.FeatureExtractorFilter
baseExtractor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BoundedFeatureExtractor

public BoundedFeatureExtractor(FeatureExtractor<? super E> extractor,
                               double minValue,
                               double maxValue)
Construct a bounded feature extractor that bounds the feature values produced by the specified extractor to be within the specified minimum and maximum values.

Parameters:
extractor - Base feature extractor.
minValue - Minimum value of a feature
maxValue - Maximum value of a feature
Throws:
IllegalArgumentException - If minVal > maxVal
Method Detail

filter

public Number filter(String feature,
                     Number value)
Return the bounded value corresponding to the specified value. The feature name is ignored.

Overrides:
filter in class ModifiedFeatureExtractor<E>
Parameters:
feature - Name of feature, which is ignored.
value - Value to filter.
Returns:
The bounded value.