com.aliasi.features
Class KnownFeatureExtractor<E>
java.lang.Object
com.aliasi.features.FeatureExtractorFilter<E>
com.aliasi.features.ModifiedFeatureExtractor<E>
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
|
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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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.
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.