ctakes ne contexts - apache/ctakes GitHub Wiki
The context annotator provides a mechanism for examining the context of existing annotations, finding
events of interest in the context, and acting on those events in some way. The negation and status
annotators both take advantage of this infrastructure by examining the context of named entities
(e.g. disorders and findings) to see if they should be considered as negated (e.g. "no chest pain")
or if their status should be modified (e.g. "myocardial infarction" should have status "history of").
In fact, the "negation annotator" is really just the context annotator configured to deal with negations.
Similarly, the "status annotator" is the context annotator configured to identify the status of named entities.
To better understand the context annotator code you should start by reading the javadocs for the class
org.apache.ctakes.necontexts.ContextAnnotator.java
. It provides a nice conceptual overview of how the code works.
Annotation Engines
Piper Files
Collects context for focus annotations for use by context consuming annotators.
Source class: ContextAnnotator
Source package: org.apache.ctakes.necontexts
Parent class: org.apache.uima.fit.component.JCasAnnotator_ImplBase
Dependencies: Sentence, Base Token
Parameter | Description | Class | Required | Default |
---|---|---|---|---|
ContextAnalyzerClass | String | No | org.apache.ctakes.necontexts.negation. NegationContextAnalyzer | |
ContextAnnotationClass | String | No | org.apache.ctakes.typesystem.type.syntax. BaseToken | |
ContextHitConsumerClass | String | No | org.apache.ctakes.necontexts.negation. NegationContextHitConsumer | |
FocusAnnotationClass | String | No | org.apache.ctakes.typesystem.type.textsem. IdentifiedAnnotation | |
MaxLeftScopeSize | int | No | 7 | |
MaxRightScopeSize | int | No | 7 | |
ScopeOrder | String | No | LEFT,RIGHT | |
WindowAnnotationClass | Type of Lookup window to use | String | No | org.apache.ctakes.typesystem.type.textspan. Sentence |
Collects context for focus annotations for use by context consuming annotators.
Source class: ThreadSafeContextAnnotator
Source package: org.apache.ctakes.necontexts.concurrent
Parent class: org.apache.ctakes.necontexts.ContextAnnotator
Dependencies: Sentence, Base Token
Parameter | Description | Class | Required | Default |
---|---|---|---|---|
ContextAnalyzerClass | String | No | org.apache.ctakes.necontexts.negation. NegationContextAnalyzer | |
ContextAnnotationClass | String | No | org.apache.ctakes.typesystem.type.syntax. BaseToken | |
ContextHitConsumerClass | String | No | org.apache.ctakes.necontexts.negation. NegationContextHitConsumer | |
FocusAnnotationClass | String | No | org.apache.ctakes.typesystem.type.textsem. IdentifiedAnnotation | |
MaxLeftScopeSize | int | No | 7 | |
MaxRightScopeSize | int | No | 7 | |
ScopeOrder | String | No | LEFT,RIGHT | |
WindowAnnotationClass | Type of Lookup window to use | String | No | org.apache.ctakes.typesystem.type.textspan. Sentence |
Partial pipeline to add assertion (e.g. negation, uncertainty) attributes based upon context.
$\textcolor{gray}{\textsf{// Partial pipeline to add assertion (e.g. negation, uncertainty) attributes based upon context. }}$
$\textcolor{gray}{\textsf{// This is not a full pipeline. }}$
$\textcolor{gray}{\textsf{// Add the context annotator for simple annotation properties }}$
$\textcolor{gray}{\textsf{// The default call sets it to detect negation }}$
$\textcolor{green}{\textbf{add}}$ ContextAnnotator
$\textcolor{gray}{\textsf{// It can also detect Status if you change some parameters from the defaults }}$
$\textcolor{green}{\textbf{add}}$ ContextAnnotator$\textcolor{purple}{\textbf{ContextAnalyzerClass}}$ =$\textcolor{violet}{\textsf{org.apache.ctakes.necontexts.status.StatusContextAnalyzer}}$ $\textcolor{purple}{\textbf{ContextHitConsumerClass}}$ =$\textcolor{violet}{\textsf{org.apache.ctakes.necontexts.status.StatusContextHitConsumer}}$ $\textcolor{purple}{\textbf{MaxLeftScopeSize}}$ =$\textcolor{violet}{\textsf{10}}$ $\textcolor{purple}{\textbf{MaxRightScopeSize}}$ =$\textcolor{violet}{\textsf{10}}$