E- Type of object whose features are extracted
public class CacheFeatureExtractor<E> extends FeatureExtractorFilter<E> implements Serializable
CacheFeatureExtractoruses a cache to store a mapping from objects to their feature vector maps.
Elements will be stored in the cache and looked up in the cache
using the standard map methods
is up to the map to remove elements.
A cached feature extractor will be thread safe if its contained
cache is thread safe. A map may be made thread safe by wrapping it
with synchronization. There are more live thread-safe maps in Java
util.concurrent package. The
HardFastCache are also both thread safe. The only
methods of the map accessed by this class are the put and get
A cached feature extractor will be serializable if its contained
map and contained feature extractor are serializable. The current
values in the cache will be included in the serialized value. To
prevent serializing values, clear the cache before serializing it
(the cache is accessible through the
cache() method. The
fast cache and most of Java's map implementations are serializable.
|Constructor and Description|
Construct a cached feature extractor that caches the results of the specified extractor using the specified cache.
|Modifier and Type||Method and Description|
Returns the cache for this cached feature extractor.
Return the features extracted by the contained feature extractor.
public CacheFeatureExtractor(FeatureExtractor<? super E> extractor, Map<E,Map<String,? extends Number>> cache)
extractor- Extractor to use to extract feature vectors.
cache- Cache in which to store extracted vectors.