|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.uima.analysis_component.AnalysisComponent_ImplBase
org.apache.uima.analysis_component.Annotator_ImplBase
org.apache.uima.analysis_component.JCasAnnotator_ImplBase
org.apache.ctakes.necontexts.ContextAnnotator
public class ContextAnnotator
The context annotator iterates through focus annotations and analyzes the surrounding context of each. The context is defined by a scope, window, and a maximum size (if applicable). The context can be further refined by boundary conditions as specified by the context analyzer used. For each focus annotation, a context is collected as a set of context annotations for each scope that is to be applied. The context annotations are passed to a context analyzer for analysis. If the context analyzer finds something of interest in the context annotations, then it will generate a context hit. Context hits are then passed to a context hit consumer which will perform an action on the hit such as updating an existing annotation or creating a new one.
| Field Summary | |
|---|---|
static int |
ALL_SCOPE
The ALL_SCOPE scope provides the context annotation that are found in all three of the other scopes (LEFT, MIDDLE, and RIGHT). |
static String |
CONTEXT_ANALYZER_CLASS_PARAM
"ContextAnalyzerClass" is a required, single, string parameter that specifies the context analyzer class that determines if a "hit" is found within a processed scope. |
static String |
CONTEXT_ANNOTATION_CLASS_PARAM
"ContextAnnotationClass" is a required, single, string parameter that specifies the annotation type of the context annotations (often "tokens") that make up the context relative to a focus annotation within a scope that is being examined. |
static String |
CONTEXT_HIT_CONSUMER_CLASS_PARAM
"ContextHitConsumerClass" is a required, single, string parameter that specifies the context hit consumer class that will process context hits that are found. |
protected ContextAnalyzer |
contextAnalyzer
|
protected ContextHitConsumer |
contextConsumer
|
static String |
FOCUS_ANNOTATION_CLASS_PARAM
"FocusAnnotationClass" is a required, single, string parameter that specifies the annotation type of the focus annotations that are going to be examined by this annotator. |
static int |
LEFT_SCOPE
|
protected int |
leftScopeSize
|
static String |
MAX_LEFT_SCOPE_SIZE_PARAM
"MaxLeftScopeSize" is a required, single, integer parameter that specifies the maximum size of the left scope. |
static String |
MAX_RIGHT_SCOPE_SIZE_PARAM
"MaxRightScopeSize" is a required, single, integer parameter that specifies the maximum size of the right scope. |
static int |
MIDDLE_SCOPE
Provides context annotations that are "inside" the focus annotation. |
static int |
RIGHT_SCOPE
|
protected int |
rightScopeSize
|
static String |
SCOPE_ORDER_PARAM
"ScopeOrder" is a required, multiple, string parameter that specifies the order that the scopes should be processed in. |
protected List<Integer> |
scopes
|
static String |
WINDOW_ANNOTATION_CLASS_PARAM
"WindowAnnotationClass" is a required, single, string parameter that specifies the annotation type of the windows that specify the hard boundaries of scopes. |
| Constructor Summary | |
|---|---|
ContextAnnotator()
|
|
| Method Summary | |
|---|---|
protected List<org.apache.uima.jcas.tcas.Annotation> |
getLeftScopeContextAnnotations(org.apache.uima.jcas.JCas jCas,
org.apache.uima.jcas.tcas.Annotation focus,
org.apache.uima.jcas.tcas.Annotation window)
|
protected List<org.apache.uima.jcas.tcas.Annotation> |
getMiddleScopeContextAnnotations(org.apache.uima.jcas.JCas jCas,
org.apache.uima.jcas.tcas.Annotation focus)
|
protected List<org.apache.uima.jcas.tcas.Annotation> |
getRightScopeContextAnnotations(org.apache.uima.jcas.JCas jCas,
org.apache.uima.jcas.tcas.Annotation focus,
org.apache.uima.jcas.tcas.Annotation window)
|
protected List<org.apache.uima.jcas.tcas.Annotation> |
getScopeContextAnnotations(org.apache.uima.jcas.JCas jCas,
org.apache.uima.jcas.tcas.Annotation focus,
org.apache.uima.jcas.tcas.Annotation window,
int scope)
|
void |
initialize(org.apache.uima.UimaContext uimaContext)
|
void |
process(org.apache.uima.jcas.JCas jCas)
|
| Methods inherited from class org.apache.uima.analysis_component.JCasAnnotator_ImplBase |
|---|
getRequiredCasInterface, process |
| Methods inherited from class org.apache.uima.analysis_component.Annotator_ImplBase |
|---|
getCasInstancesRequired, hasNext, next |
| Methods inherited from class org.apache.uima.analysis_component.AnalysisComponent_ImplBase |
|---|
batchProcessComplete, collectionProcessComplete, destroy, getContext, getResultSpecification, reconfigure, setResultSpecification |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String MAX_LEFT_SCOPE_SIZE_PARAM
public static final String MAX_RIGHT_SCOPE_SIZE_PARAM
public static final String SCOPE_ORDER_PARAM
public static final String WINDOW_ANNOTATION_CLASS_PARAM
DocumentAnnotation,
edu.mayo.bmi.common.type.Sentence,
edu.mayo.bmi.common.type.Segment,
Constant Field Valuespublic static final String FOCUS_ANNOTATION_CLASS_PARAM
edu.mayo.bmi.common.type.NamedEntity,
edu.mayo.bmi.common.type.BaseToken,
Constant Field Valuespublic static final String CONTEXT_ANNOTATION_CLASS_PARAM
edu.mayo.bmi.common.type.BaseToken,
edu.mayo.bmi.common.type.WordToken,
edu.mayo.bmi.common.type.NamedEntity,
Constant Field Valuespublic static final String CONTEXT_ANALYZER_CLASS_PARAM
ContextAnalyzer,
Constant Field Valuespublic static final String CONTEXT_HIT_CONSUMER_CLASS_PARAM
ContextHitConsumer,
Constant Field Valuespublic static final int LEFT_SCOPE
public static final int MIDDLE_SCOPE
public static final int RIGHT_SCOPE
public static final int ALL_SCOPE
protected int leftScopeSize
protected int rightScopeSize
protected List<Integer> scopes
protected ContextAnalyzer contextAnalyzer
protected ContextHitConsumer contextConsumer
| Constructor Detail |
|---|
public ContextAnnotator()
| Method Detail |
|---|
public void initialize(org.apache.uima.UimaContext uimaContext)
throws org.apache.uima.resource.ResourceInitializationException
initialize in interface org.apache.uima.analysis_component.AnalysisComponentinitialize in class org.apache.uima.analysis_component.AnalysisComponent_ImplBaseorg.apache.uima.resource.ResourceInitializationException
public void process(org.apache.uima.jcas.JCas jCas)
throws org.apache.uima.analysis_engine.AnalysisEngineProcessException
process in class org.apache.uima.analysis_component.JCasAnnotator_ImplBaseorg.apache.uima.analysis_engine.AnalysisEngineProcessException
protected List<org.apache.uima.jcas.tcas.Annotation> getScopeContextAnnotations(org.apache.uima.jcas.JCas jCas,
org.apache.uima.jcas.tcas.Annotation focus,
org.apache.uima.jcas.tcas.Annotation window,
int scope)
throws org.apache.uima.analysis_engine.AnalysisEngineProcessException
org.apache.uima.analysis_engine.AnalysisEngineProcessException
protected List<org.apache.uima.jcas.tcas.Annotation> getLeftScopeContextAnnotations(org.apache.uima.jcas.JCas jCas,
org.apache.uima.jcas.tcas.Annotation focus,
org.apache.uima.jcas.tcas.Annotation window)
throws org.apache.uima.analysis_engine.AnalysisEngineProcessException
org.apache.uima.analysis_engine.AnalysisEngineProcessException
protected List<org.apache.uima.jcas.tcas.Annotation> getRightScopeContextAnnotations(org.apache.uima.jcas.JCas jCas,
org.apache.uima.jcas.tcas.Annotation focus,
org.apache.uima.jcas.tcas.Annotation window)
throws org.apache.uima.analysis_engine.AnalysisEngineProcessException
org.apache.uima.analysis_engine.AnalysisEngineProcessException
protected List<org.apache.uima.jcas.tcas.Annotation> getMiddleScopeContextAnnotations(org.apache.uima.jcas.JCas jCas,
org.apache.uima.jcas.tcas.Annotation focus)
throws org.apache.uima.analysis_engine.AnalysisEngineProcessException
org.apache.uima.analysis_engine.AnalysisEngineProcessException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||