public class TfidfExtractor<OUTCOME_T,FOCUS_T extends Annotation> extends OneToOneTrainableExtractor_ImplBase<OUTCOME_T> implements FeatureExtractor1<FOCUS_T>
Copyright (c) 2012, Regents of the University of Colorado
All rights reserved.
| Modifier and Type | Class and Description |
|---|---|
protected static class |
TfidfExtractor.IDFMap |
| Modifier and Type | Field and Description |
|---|---|
protected TfidfExtractor.IDFMap |
idfMap |
protected boolean |
isTrained |
protected FeatureExtractor1<FOCUS_T> |
subExtractor |
name| Constructor and Description |
|---|
TfidfExtractor(String name) |
TfidfExtractor(String name,
FeatureExtractor1<FOCUS_T> extractor) |
| Modifier and Type | Method and Description |
|---|---|
protected TfidfExtractor.IDFMap |
createIdfMap(Iterable<Instance<OUTCOME_T>> instances) |
List<Feature> |
extract(JCas view,
FOCUS_T focusAnnotation)
Some feature extractors will require some specific number of annotations that is greater than
one.
|
void |
load(URI documentFreqDataURI)
Loads statistics from location URI
|
void |
save(URI documentFreqDataURI)
Saves statistics from train in location URI
|
void |
train(Iterable<Instance<OUTCOME_T>> instances)
In the prototypical case, train takes a collection of instances and computes statistics over
the values such as computing mean, standard deviation, TF*IDF, etc...
|
protected Feature |
transform(Feature feature) |
isTransformable, transformprotected TfidfExtractor.IDFMap idfMap
protected boolean isTrained
protected FeatureExtractor1<FOCUS_T extends Annotation> subExtractor
public TfidfExtractor(String name)
public TfidfExtractor(String name, FeatureExtractor1<FOCUS_T> extractor)
extractor - - This assumes that any extractors passed in will produce counts of some varietyprotected TfidfExtractor.IDFMap createIdfMap(Iterable<Instance<OUTCOME_T>> instances)
public List<Feature> extract(JCas view, FOCUS_T focusAnnotation) throws CleartkExtractorException
FeatureExtractor1extract in interface FeatureExtractor1<FOCUS_T extends Annotation>view - the current view of the document.focusAnnotation - the annotation for which to collect features.CleartkExtractorExceptionpublic void load(URI documentFreqDataURI) throws IOException
TrainableExtractorload in interface TrainableExtractor<OUTCOME_T>IOExceptionpublic void save(URI documentFreqDataURI) throws IOException
TrainableExtractorsave in interface TrainableExtractor<OUTCOME_T>IOExceptionpublic void train(Iterable<Instance<OUTCOME_T>> instances)
TrainableExtractortrain in interface TrainableExtractor<OUTCOME_T>instances - - URI pointing to the output location for saving statisticsCopyright © 2014. All rights reserved.