public class ChunkAdjuster
extends JCasAnnotator_ImplBase
Modifier and Type | Field and Description |
---|---|
private java.lang.String[] |
chunksTypesInPattern |
private int |
indexOfTokenToInclude |
private Logger |
logger |
static java.lang.String |
PARAM_CHUNK_PATTERN
The pattern of chunks that trigger an adjustment.
|
static java.lang.String |
PARAM_EXTEND_TO_INCLUDE_TOKEN
The index of the token (within the pattern) to extend the end offset to
include.
|
Constructor and Description |
---|
ChunkAdjuster() |
Modifier and Type | Method and Description |
---|---|
protected void |
annotateRange(JCas jcas,
int rangeBegin,
int rangeEnd)
A utility method that annotates a given range.
|
protected void |
annotateSentence(JCas jcas,
Sentence sent) |
private boolean |
compareToPattern(java.util.List<Chunk> list,
int i)
Compares the chunks at index i to the 1st element on the pattern, i+1 to
the 2nd element, etc and returns true if the chunks starting at i fit the
pattern
|
private void |
configInit()
Sets configuration parameters with values from the descriptor.
|
static AnalysisEngineDescription |
createAnnotatorDescription(java.lang.String[] chunkPattern,
int patternIndex) |
private static Chunk |
extendChunk(Chunk chunk,
int newEnd)
Update the end value for the chunk to have the new value
|
void |
initialize(UimaContext aContext)
Performs initialization logic.
|
void |
process(JCas jcas)
Invokes this annotator's analysis logic.
|
private void |
removeEnvelopedChunks(java.util.List<Chunk> list,
int i)
Remove from our local list of chunks the chunks that have been enveloped.
|
public static final java.lang.String PARAM_CHUNK_PATTERN
private java.lang.String[] chunksTypesInPattern
public static final java.lang.String PARAM_EXTEND_TO_INCLUDE_TOKEN
private int indexOfTokenToInclude
private Logger logger
public void initialize(UimaContext aContext) throws ResourceInitializationException
ResourceInitializationException
org.apache.uima.analysis_engine.annotator.BaseAnnotator#initialize(AnnotatorContext)
private void configInit() throws ResourceInitializationException
ResourceInitializationException
public void process(JCas jcas) throws AnalysisEngineProcessException
AnalysisEngineProcessException
protected void annotateSentence(JCas jcas, Sentence sent) throws AnalysisEngineProcessException
AnalysisEngineProcessException
protected void annotateRange(JCas jcas, int rangeBegin, int rangeEnd) throws AnalysisEngineProcessException
AnalysisEngineProcessException
private void removeEnvelopedChunks(java.util.List<Chunk> list, int i)
private boolean compareToPattern(java.util.List<Chunk> list, int i)
list
- the list of chunksi
- the position within the list to compare to the patterni
in the list. Note if there aren't enough
chunks in the list starting at i to match the pattern, returns
false.AnnotatorProcessException
private static Chunk extendChunk(Chunk chunk, int newEnd) throws AnalysisEngineProcessException
chunk
- The chunk to updatenewEnd
- The new end value for the chunk.AnnotatorProcessException
AnalysisEngineProcessException
public static AnalysisEngineDescription createAnnotatorDescription(java.lang.String[] chunkPattern, int patternIndex) throws ResourceInitializationException
ResourceInitializationException