Skip to content

ctakes ne contexts

Sean Finan edited this page Jun 6, 2024 · 5 revisions

ctakes-ne-contexts

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


Annotation Engines

Context Annotator

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

Thread safe Context Annotator

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

Piper Files

Ne Contexts Sub Pipe

Partial pipeline to add assertion (e.g. negation, uncertainty) attributes based upon context.

Ne Contexts Sub Pipe

$\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}{\textsf{add}}$ ContextAnnotator
$\textcolor{gray}{\textsf{// It can also detect Status if you change some parameters from the defaults }}$
$\textcolor{green}{\textsf{add}}$ ContextAnnotator $\textcolor{purple}{\textsf{ContextAnalyzerClass}}$= $\textcolor{violet}{\textsf{org.apache.ctakes.necontexts.status.StatusContextAnalyzer}}$ $\textcolor{purple}{\textsf{ContextHitConsumerClass}}$= $\textcolor{violet}{\textsf{org.apache.ctakes.necontexts.status.StatusContextHitConsumer}}$ $\textcolor{purple}{\textsf{MaxLeftScopeSize}}$= $\textcolor{violet}{\textsf{10}}$ $\textcolor{purple}{\textsf{MaxRightScopeSize}}$= $\textcolor{violet}{\textsf{10}}$

Clone this wiki locally