com.aliasi.features
Class ModifiedFeatureExtractor<E>

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

public abstract class ModifiedFeatureExtractor<E>
extends FeatureExtractorFilter<E>
implements FeatureExtractor<E>

A ModifiedFeatureExtractor allows feature values to be modified in a feature-specific fashion.

Since:
Lingpipe3.8
Version:
3.8
Author:
Bob Carpenter

Constructor Summary
ModifiedFeatureExtractor(FeatureExtractor<? super E> extractor)
          Construct a modified feature extractor with the specified base extractor.
 
Method Summary
 Map<String,? extends Number> features(E in)
          Return the modified form of the feature vector produced by the base feature extractor.
 Number filter(String feature, Number value)
          Return the value for the specified original feature and value, or null to remove the feature altogether.
 
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

ModifiedFeatureExtractor

public ModifiedFeatureExtractor(FeatureExtractor<? super E> extractor)
Construct a modified feature extractor with the specified base extractor.

Parameters:
extractor - Base feature extractor.
Method Detail

features

public Map<String,? extends Number> features(E in)
Return the modified form of the feature vector produced by the base feature extractor. Each feature/value pair will be passed through the method filter(String,Number) to produce a new value, which if non-null, is added to the result.

Specified by:
features in interface FeatureExtractor<E>
Overrides:
features in class FeatureExtractorFilter<E>
Parameters:
in - Input to be converted to a feature vector.
Returns:
The modified feature vector.

filter

public Number filter(String feature,
                     Number value)
Return the value for the specified original feature and value, or null to remove the feature altogether.

This implementation passes through the value.

Parameters:
feature - Feature corresponding to the value.
value - Value to filter.
Returns:
The modified value or null.