public class SentenceTokensPrinter
extends CasConsumer_ImplBase
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
_outputDirPath |
private static Logger |
LOGGER |
static java.lang.String |
PARAM_OUTPUTDIR |
Constructor and Description |
---|
SentenceTokensPrinter() |
Modifier and Type | Method and Description |
---|---|
private static java.lang.String |
getSentenceTokens(JCas jcas,
Annotation sentence) |
void |
initialize()
Checks for parameter
OutputDirectory . |
private void |
outputSentenceTokens(java.lang.String documentId,
java.lang.Iterable<java.lang.String> tokenizedSentences) |
private static void |
printSentenceTokens(java.lang.String documentId,
java.lang.Iterable<java.lang.String> tokenizedSentences)
Prints the (base) tokens of each sentence on a separate line, separated by spaces, on standard output
|
void |
processCas(CAS cas)
Saves the (base) tokens of each sentence on a separate line, separated by spaces
|
private static void |
saveSentenceTokens(java.lang.String outputDirPath,
java.lang.String documentId,
java.lang.Iterable<java.lang.String> tokenizedSentences)
Saves the (base) tokens of each sentence on a separate line, separated by spaces
|
private static final Logger LOGGER
public static final java.lang.String PARAM_OUTPUTDIR
private java.lang.String _outputDirPath
public void initialize() throws ResourceInitializationException
OutputDirectory
. If present then files will be saved, if not stdout is used.
ResourceInitializationException
- if parameter OutputDirectory
has an invalid valuepublic void processCas(CAS cas) throws ResourceProcessException
ResourceProcessException
private static java.lang.String getSentenceTokens(JCas jcas, Annotation sentence)
jcas
- -sentence
- -private void outputSentenceTokens(java.lang.String documentId, java.lang.Iterable<java.lang.String> tokenizedSentences)
documentId
- id of the document, used for output identification of the analyzed documenttokenizedSentences
- space-separated sentence tokensprivate static void printSentenceTokens(java.lang.String documentId, java.lang.Iterable<java.lang.String> tokenizedSentences)
documentId
- id of the document, used for output identification of the analyzed documenttokenizedSentences
- space-separated sentence tokensprivate static void saveSentenceTokens(java.lang.String outputDirPath, java.lang.String documentId, java.lang.Iterable<java.lang.String> tokenizedSentences)
outputDirPath
- root output directory specified by parameter OutputDirectory
documentId
- id of the document, used for the output file name of the analyzed documenttokenizedSentences
- space-separated sentence tokens