public class ContextAnnotator
extends JCasAnnotator_ImplBase
Modifier and Type | Field and Description |
---|---|
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 java.lang.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 java.lang.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 java.lang.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 |
(package private) int |
contextType |
static java.lang.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.
|
(package private) int |
focusType |
private Logger |
iv_logger |
static int |
LEFT_SCOPE |
protected int |
leftScopeSize |
static java.lang.String |
MAX_LEFT_SCOPE_SIZE_PARAM
"MaxLeftScopeSize" is a required, single, integer parameter that
specifies the maximum size of the left scope.
|
static java.lang.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 java.lang.String |
SCOPE_ORDER_PARAM
"ScopeOrder" is a required, multiple, string parameter that specifies the
order that the scopes should be processed in.
|
protected java.util.List<java.lang.Integer> |
scopes |
static java.lang.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.
|
(package private) int |
windowType |
Constructor and Description |
---|
ContextAnnotator() |
Modifier and Type | Method and Description |
---|---|
private java.util.List<Annotation> |
constrainToWindow(JCas jCas,
int type,
Annotation window)
Gets a list of annotations within the specified window annotation.
|
protected java.util.List<Annotation> |
getLeftScopeContextAnnotations(JCas jCas,
Annotation focus,
Annotation window) |
protected java.util.List<Annotation> |
getMiddleScopeContextAnnotations(JCas jCas,
Annotation focus) |
protected java.util.List<Annotation> |
getRightScopeContextAnnotations(JCas jCas,
Annotation focus,
Annotation window) |
protected java.util.List<Annotation> |
getScopeContextAnnotations(JCas jCas,
Annotation focus,
Annotation window,
int scope) |
void |
initialize(UimaContext uimaContext) |
(package private) void |
parseScopeOrder(java.lang.String[] scopeStrings) |
void |
process(JCas jCas) |
private Logger iv_logger
public static final java.lang.String MAX_LEFT_SCOPE_SIZE_PARAM
public static final java.lang.String MAX_RIGHT_SCOPE_SIZE_PARAM
public static final java.lang.String SCOPE_ORDER_PARAM
public static final java.lang.String WINDOW_ANNOTATION_CLASS_PARAM
DocumentAnnotation
,
edu.mayo.bmi.common.type.Sentence
,
edu.mayo.bmi.common.type.Segment
,
Constant Field Valuespublic static final java.lang.String FOCUS_ANNOTATION_CLASS_PARAM
edu.mayo.bmi.common.type.NamedEntity
,
edu.mayo.bmi.common.type.BaseToken
,
Constant Field Valuespublic static final java.lang.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 java.lang.String CONTEXT_ANALYZER_CLASS_PARAM
ContextAnalyzer
,
Constant Field Valuespublic static final java.lang.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 java.util.List<java.lang.Integer> scopes
protected ContextAnalyzer contextAnalyzer
protected ContextHitConsumer contextConsumer
int windowType
int focusType
int contextType
public void initialize(UimaContext uimaContext) throws ResourceInitializationException
ResourceInitializationException
void parseScopeOrder(java.lang.String[] scopeStrings) throws AnnotatorConfigurationException
AnnotatorConfigurationException
public void process(JCas jCas) throws AnalysisEngineProcessException
AnalysisEngineProcessException
protected java.util.List<Annotation> getScopeContextAnnotations(JCas jCas, Annotation focus, Annotation window, int scope) throws AnalysisEngineProcessException
AnalysisEngineProcessException
protected java.util.List<Annotation> getLeftScopeContextAnnotations(JCas jCas, Annotation focus, Annotation window) throws AnalysisEngineProcessException
AnalysisEngineProcessException
protected java.util.List<Annotation> getRightScopeContextAnnotations(JCas jCas, Annotation focus, Annotation window) throws AnalysisEngineProcessException
AnalysisEngineProcessException
protected java.util.List<Annotation> getMiddleScopeContextAnnotations(JCas jCas, Annotation focus) throws AnalysisEngineProcessException
AnalysisEngineProcessException
private java.util.List<Annotation> constrainToWindow(JCas jCas, int type, Annotation window)
annotItr
- window
- jcas
- java.lang.Exception