com.aliasi.features
Class KnownFeatureExtractor<E>

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

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

A KnownFeatureExtractor restricts a base feature extractor to features contained in a set provided at construction time.

Serialization

A known feature extractor is serializable if its base extractor is serializable. If the base extractor is not serializable, attempts to serialize throw a java.io.NotSerializableException.

Since:
Lingpipe3.9
Version:
3.8.1
Author:
Bob Carpenter
See Also:
Serialized Form

Constructor Summary
KnownFeatureExtractor(FeatureExtractor<? super E> baseExtractor, Set<String> knownFeatureSet)
          Construct a known feature extractor based on the specified feature set and base extractor.
 
Method Summary
 Number filter(String feature, Number value)
          Returns the value if the feature is in the known feature set and null otherwise.
 Set<String> knownFeatureSet()
          Returns and unmodifiable view of the known feature set for this known feature extractor.
 
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

KnownFeatureExtractor

public KnownFeatureExtractor(FeatureExtractor<? super E> baseExtractor,
                             Set<String> knownFeatureSet)
Construct a known feature extractor based on the specified feature set and base extractor.

Parameters:
knownFeatureSet - Set of known features.
baseExtractor - Base feature extractor.
Method Detail

filter

public Number filter(String feature,
                     Number value)
Returns the value if the feature is in the known feature set and null otherwise.

Overrides:
filter in class ModifiedFeatureExtractor<E>
Parameters:
feature - Feature corresponding to the value.
value - Value to filter.
Returns:
The value if the feature is in the known feature set and null otherwise.

knownFeatureSet

public Set<String> knownFeatureSet()
Returns and unmodifiable view of the known feature set for this known feature extractor.

Returns:
View of the known feature set.