@PipeBitInfo(name="Word Count Writer", description="Writes a two-column BSV file containing Words and their total counts in a document.", role=WRITER, dependencies=BASE_TOKEN) public class TokenFreqCasConsumer extends org.apache.uima.collection.CasConsumer_ImplBase
Modifier and Type | Field and Description |
---|---|
static String |
PARAM_WORD_FREQ_FILE
The name of the parameter that is specifies the path of the output file in the
descriptor file.
|
Constructor and Description |
---|
TokenFreqCasConsumer() |
Modifier and Type | Method and Description |
---|---|
void |
collectionProcessComplete(org.apache.uima.util.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(org.apache.uima.cas.CAS cas)
Iterates through all of the WordTokenAnnotation's, gets the covered text for each annotation
and increments the frequency count for that text.
|
batchProcessComplete, destroy, getProcessingResourceMetaData, initialize, isReadOnly, isStateless, processCas, reconfigure, typeSystemInit
getConfigParameterValue, getConfigParameterValue, setConfigParameterValue, setConfigParameterValue
getCasManager, getLogger, getMetaData, getResourceManager, getUimaContext, getUimaContextAdmin, setLogger, setMetaData
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static final String PARAM_WORD_FREQ_FILE
public void initialize() throws org.apache.uima.resource.ResourceInitializationException
initialize
in class org.apache.uima.collection.CasConsumer_ImplBase
org.apache.uima.resource.ResourceInitializationException
CasConsumer_ImplBase.initialize()
public void processCas(org.apache.uima.cas.CAS cas) throws org.apache.uima.resource.ResourceProcessException
org.apache.uima.resource.ResourceProcessException
CasObjectProcessor.processCas(org.apache.uima.cas.CAS)
public void collectionProcessComplete(org.apache.uima.util.ProcessTrace arg0) throws org.apache.uima.resource.ResourceProcessException, IOException
collectionProcessComplete
in interface org.apache.uima.collection.base_cpm.CasProcessor
collectionProcessComplete
in class org.apache.uima.collection.CasConsumer_ImplBase
org.apache.uima.resource.ResourceProcessException
IOException
Copyright © 2012-2017 The Apache Software Foundation. All Rights Reserved.