public class TokenFreqCasConsumer
extends CasConsumer_ImplBase
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
PARAM_WORD_FREQ_FILE
The name of the parameter that is specifies the path of the output file in the
descriptor file.
|
(package private) java.io.File |
wordFreqFile |
(package private) java.util.Map<java.lang.String,int[]> |
wordFreqs |
Constructor and Description |
---|
TokenFreqCasConsumer() |
Modifier and Type | Method and Description |
---|---|
void |
collectionProcessComplete(ProcessTrace arg0)
This method sorts the frequency counts and prints out the resulting frequencies in descending
order to the frequency file in 'word|count' format.
|
void |
initialize()
This method opens/creates the file specified by "TokenFreqFile" and initializes the
data structure that will keep track of frequency counts.
|
void |
processCas(CAS cas)
Iterates through all of the WordTokenAnnotation's, gets the covered text for each annotation
and increments the frequency count for that text.
|
public static final java.lang.String PARAM_WORD_FREQ_FILE
java.io.File wordFreqFile
java.util.Map<java.lang.String,int[]> wordFreqs
public void initialize() throws ResourceInitializationException
ResourceInitializationException
org.apache.uima.collection.CasConsumer_ImplBase#initialize()
public void processCas(CAS cas) throws ResourceProcessException
ResourceProcessException
org.apache.uima.collection.base_cpm.CasObjectProcessor#processCas(org.apache.uima.cas.CAS)
public void collectionProcessComplete(ProcessTrace arg0) throws ResourceProcessException, java.io.IOException
ResourceProcessException
java.io.IOException