org.writersforge.catalan.transform
Class TextProcessor

java.lang.Object
  |
  +--org.writersforge.catalan.transform.BaseNodeProcessor
        |
        +--org.writersforge.catalan.transform.TextProcessor
All Implemented Interfaces:
org.writersforge.bellows.traverse.NodeProcessor
Direct Known Subclasses:
Normalizer, TextReplacer, TokenSplitter, VariableTextReplacer

public abstract class TextProcessor
extends BaseNodeProcessor

The shared base class for all Catalan ASCII text processors.

Author:
jsheets

Constructor Summary
TextProcessor()
          Creates a new instance of TextProcessor.
 
Method Summary
 java.util.List processNode(java.lang.Object node)
          Process a single node.
protected abstract  java.util.List processText(java.lang.String text)
          Processes the text node.
 
Methods inherited from class org.writersforge.catalan.transform.BaseNodeProcessor
addLeftover, end, getLeftovers, getNodes, start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextProcessor

public TextProcessor()
Creates a new instance of TextProcessor.

Method Detail

processNode

public java.util.List processNode(java.lang.Object node)
Process a single node. The processing action can be any arbitrary task, such as text replacement, data restructuring, or even statistical gathering. The processor should return a processed version of the node; this can be the same object untouched, or the same object modified, or a new set of objects.

Parameters:
node - the node to process
Returns:
a List of processing results (can be empty)

processText

protected abstract java.util.List processText(java.lang.String text)
Processes the text node. Not called for non-String nodes.

Parameters:
text - the text to process
Returns:
the processed text