You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ctakes.apache.org by Michael Trepanier <mi...@metistream.com> on 2019/03/11 18:19:03 UTC
Re: Temporal Relations Absent from cTAKES Output
Just following up on this. I adjusted the previous pipeline to the one
shown below and can generate temporal annotations.
// Token processing pipeline.
builder.add(SimpleSegmentAnnotator.createAnnotatorDescription)
builder.add(SentenceDetector.createAnnotatorDescription)
builder.add(TokenizerAnnotatorPTB.createAnnotatorDescription)
builder.add(LvgAnnotator.createAnnotatorDescription()) // Sometimes
commented out.
builder.add(ContextDependentTokenizerAnnotator.createAnnotatorDescription)
builder.add(POSTagger.createAnnotatorDescription)
builder.add(AnalysisEngineFactory.createEngineDescription(classOf[CopyNPChunksToLookupWindowAnnotations]))
// Added.
builder.add(AnalysisEngineFactory.createEngineDescription(classOf[RemoveEnclosedLookupWindows]))
// Added.
// Ontology mapping/confidence.
builder.add(
DefaultJCasTermAnnotator.createAnnotatorDescription(
"my_dictionary.xml"))
builder.add(ClearNLPDependencyParserAE.createAnnotatorDescription)
builder.add(PolarityCleartkAnalysisEngine.createAnnotatorDescription)
builder.add(HistoryCleartkAnalysisEngine.createAnnotatorDescription)
builder.add(SubjectCleartkAnalysisEngine.createAnnotatorDescription)
// Temporal additions.
builder.add(
BackwardsTimeAnnotator.createAnnotatorDescription(
"models\\timeannotator.jar"))
builder.add(
EventAnnotator.createAnnotatorDescription(
"models\\eventannotator.jar"))
builder.add(
AnalysisEngineFactory.createEngineDescription(classOf[AddEvent]))
builder.add(
EventTimeRelationAnnotator.createAnnotatorDescription("models\\eventtime.jar"))
builder.createAggregateDescription
As well, I can extract the generated temporal annotations with the below
line of code:
val relations = JCasUtil.select(jcas, classOf[TemporalTextRelation]).asScala
However, the pipeline does not appear to be adding the temporal annotations
to annotations of class EventMention or its subclasses. For example, if I
have an instance of a DiseaseDisorderMention, calling d
iseaseDisorderMention.getRelativeTemporalContext always returns a null. Am
I missing pipeline steps which link the TemporalTextRelation instances to
EventMention instances, or is it necessary to manually do this?
Thanks,
Mike
On Tue, Feb 19, 2019 at 4:47 PM Michael Trepanier <mi...@metistream.com>
wrote:
> Hi,
> I have a pipeline defined by the below aggregate description (in Scala).
>
> aed = {
> builder.add(SimpleSegmentAnnotator.createAnnotatorDescription)
> builder.add(SentenceDetector.createAnnotatorDescription)
> builder.add(TokenizerAnnotatorPTB.createAnnotatorDescription)
> builder.add(ThreadSafeLvg.createAnnotatorDescription)
>
> builder.add(ContextDependentTokenizerAnnotator.createAnnotatorDescription)
> builder.add(POSTagger.createAnnotatorDescription)
> builder.add(
> DefaultJCasTermAnnotator.createAnnotatorDescription(
> "path/to/file.xml"))
> builder.add(ClearNLPDependencyParserAE.createAnnotatorDescription)
> builder.add(PolarityCleartkAnalysisEngine.createAnnotatorDescription)
> builder.add(HistoryCleartkAnalysisEngine.createAnnotatorDescription)
> builder.add(SubjectCleartkAnalysisEngine.createAnnotatorDescription)
> // Temporal analysis steps.
> builder.add(EventAnnotator.createAnnotatorDescription)
>
> builder.add(AnalysisEngineFactory.createEngineDescription(classOf[CopyPropertiesToTemporalEventAnnotator]))
>
> builder.add(DocTimeRelAnnotator.createAnnotatorDescription("path/to/default/model.jar"))
>
> builder.add(BackwardsTimeAnnotator.createAnnotatorDescription("path/to/default/model.jar"))
> builder.createAggregateDescription
> }
>
> At the end of the pipeline, I have added the four temporal pipeline stages
> defined in
> https://github.com/apache/ctakes/blob/ctakes-4.0.0/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/pipelines/FullTemporalExtractionPipeline.java
> in order glean temporal information.
>
> However, when running this pipeline against the following text: "The
> patient underwent a CT scan in April which did not reveal lesions in his
> liver", the temporal related fields are always null.
>
> My processing pipeline goes as follows:
>
> 1) Run above pipeline.
> 2) Glean all IdentifiedAnnotations from index.
> 3) Filter to all EventMention type annotations (subclass of
> IdentifiedAnnotation).
> 4) Filter to all MedicationMention, ProcecureMention,
> DiseaseDisorderMention, or SignSymptomMention annotations (subclass of
> EventMention).
> 5) Use these subclasses' "getRelativeTemporalContext" method to get the
> TemporalTextRelations.
>
> After step 5, the TemporalTextRelations are always null. Am I going about
> ascertaining this information the wrong way? Referencing
> http://qiicr.org/CI4CC-Spring2016-ASW/assets/CI4CC2016-Finan.pdf, this
> sentence should yield TemporalTextRelations.
>
> Thanks,
>
> Mike
>
>
>
>
> --
> [image: MetiStream Logo - 500]
> Mike Trepanier| Senior Engineer | MetiStream, Inc. | mike@metistream.com |
> 845 - 270 - 3129 (m) | www.metistream.com
>
--
[image: MetiStream Logo - 500]
Mike Trepanier| Senior Big Data Engineer | MetiStream, Inc. |
mike@metistream.com | 845 - 270 - 3129 (m) | www.metistream.com