org.apache.ctakes.necontexts
Interface ContextAnalyzer

All Known Implementing Classes:
ContextAnalyzerAdapter, DxContextAnalyzerImpl, NamedEntityContextAnalyzer, NamedEntityContextAnalyzer, NegationContextAnalyzer, NegationContextAnalyzer, NegativeContextAnalyzerImpl, NegContextInitializerImpl, StatusContextAnalyzer

public interface ContextAnalyzer

A context analyzer analyzes a set of annotations that make up a context and produces context hits which are consumed by context hit consumers.

See Also:
for an example, ContextHitConsumer

Method Summary
 ContextHit analyzeContext(java.util.List<? extends org.apache.uima.jcas.tcas.Annotation> contextAnnotations, int scopeOrientation)
          This method is called by the ContextAnnotator.
 void initialize(org.apache.uima.UimaContext context)
          This will be called by the ContextAnnotator during its initialize method
 boolean isBoundary(org.apache.uima.jcas.tcas.Annotation contextAnnotation, int scopeOrientation)
          This method is called by the ContextAnnotator.
 

Method Detail

initialize

void initialize(org.apache.uima.UimaContext context)
                throws org.apache.uima.resource.ResourceInitializationException
This will be called by the ContextAnnotator during its initialize method

Parameters:
context -
Throws:
org.apache.uima.analysis_engine.annotator.AnnotatorConfigurationException
org.apache.uima.analysis_engine.annotator.AnnotatorInitializationException
org.apache.uima.resource.ResourceInitializationException

isBoundary

boolean isBoundary(org.apache.uima.jcas.tcas.Annotation contextAnnotation,
                   int scopeOrientation)
                   throws org.apache.uima.analysis_engine.AnalysisEngineProcessException
This method is called by the ContextAnnotator.

For the left and right scopes, the context annotator will collect a number of annotations up to the maximum specified by the appropriate parameter unless it comes to the edge of the window annotation or a boundary condition is met as specified by this method. For example, you may specify that the scope is LEFT, the maximum left scope size is 10, the context annotation is a token of some sort, and the window annotation is a sentence. The context annotator will collect the annotations to the left of the focus annotation such that there will be no more than 10 context annotations, they will all be inside the sentence, and no context annotations will be collected to the left of a boundary condition as specified by this method.

Parameters:
contextAnnotation - the context annotation that may or may not satisfy a boundary condition
scopeOrientation - the scope of the context annotator. The value will be the left or right scope.
Returns:
true if the context annotation satisfies a boundary condition.
Throws:
org.apache.uima.analysis_engine.annotator.AnnotatorProcessException
org.apache.uima.analysis_engine.AnalysisEngineProcessException
See Also:
ContextAnnotator.LEFT_SCOPE, ContextAnnotator.RIGHT_SCOPE, NamedEntityContextAnalyzer.isBoundary(Annotation, int)

analyzeContext

ContextHit analyzeContext(java.util.List<? extends org.apache.uima.jcas.tcas.Annotation> contextAnnotations,
                          int scopeOrientation)
                          throws org.apache.uima.analysis_engine.AnalysisEngineProcessException
This method is called by the ContextAnnotator.

This method analyzes a list of context annotations to determine if there is a "context hit" - some event that we are looking for in the context.

Parameters:
contextAnnotations - the annotations to be analyzed
scopeOrientation - the scope of the context annotator. The value will be the left, right, middle, or "all" context.
Returns:
a context hit if one exists, else null is returned.
Throws:
org.apache.uima.analysis_engine.annotator.AnnotatorProcessException
org.apache.uima.analysis_engine.AnalysisEngineProcessException
See Also:
NegationContextAnalyzer.analyzeContext(List, int), ContextAnnotator.LEFT_SCOPE, ContextAnnotator.RIGHT_SCOPE, ContextAnnotator.MIDDLE_SCOPE, ContextAnnotator.ALL_SCOPE