org.apache.ctakes.smokingstatus.context
Class NamedEntityContextAnalyzer

java.lang.Object
  extended by org.apache.ctakes.smokingstatus.context.NamedEntityContextAnalyzer
All Implemented Interfaces:
ContextAnalyzer
Direct Known Subclasses:
NegationContextAnalyzer

public abstract class NamedEntityContextAnalyzer
extends java.lang.Object
implements ContextAnalyzer

This context analyzer provides code that is shared by the StatusContextAnalyzer and NegationContextAnalyzer which are both analyzers that examine the contexts surrounding named entity annotations.


Constructor Summary
NamedEntityContextAnalyzer()
           
 
Method Summary
 void initialize(org.apache.uima.UimaContext annotatorContext)
          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.
protected  java.util.List<TextToken> wrapAsFsmTokens(java.util.List<? extends org.apache.uima.jcas.tcas.Annotation> tokenList)
          This method converts Token annotations to TextTokens required by the fsm library used by both subclasses of this class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.ctakes.necontexts.ContextAnalyzer
analyzeContext
 

Constructor Detail

NamedEntityContextAnalyzer

public NamedEntityContextAnalyzer()
Method Detail

initialize

public void initialize(org.apache.uima.UimaContext annotatorContext)
                throws org.apache.uima.resource.ResourceInitializationException
Description copied from interface: ContextAnalyzer
This will be called by the ContextAnnotator during its initialize method

Specified by:
initialize in interface ContextAnalyzer
Throws:
org.apache.uima.resource.ResourceInitializationException

isBoundary

public boolean isBoundary(org.apache.uima.jcas.tcas.Annotation contextAnnotation,
                          int scopeOrientation)
                   throws org.apache.uima.analysis_engine.AnalysisEngineProcessException
Description copied from interface: ContextAnalyzer
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.

Specified by:
isBoundary in interface ContextAnalyzer
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.AnalysisEngineProcessException
See Also:
ContextAnnotator.LEFT_SCOPE, ContextAnnotator.RIGHT_SCOPE, NamedEntityContextAnalyzer.isBoundary(Annotation, int)

wrapAsFsmTokens

protected java.util.List<TextToken> wrapAsFsmTokens(java.util.List<? extends org.apache.uima.jcas.tcas.Annotation> tokenList)
This method converts Token annotations to TextTokens required by the fsm library used by both subclasses of this class.

Parameters:
tokenList - a list of token annotations
Returns:
a conversion of the token annotations as a list of TextTokens