You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ctakes.apache.org by ja...@apache.org on 2013/05/08 22:05:45 UTC
svn commit: r1480434 - in /ctakes/trunk/ctakes-template-filler: ./ desc/
desc/analysis_engine/ src/main/java/org/ src/main/java/org/apache/
src/main/java/org/apache/ctakes/ src/main/java/org/apache/ctakes/template/
src/main/java/org/apache/ctakes/templ...
Author: james-masanz
Date: Wed May 8 20:05:44 2013
New Revision: 1480434
URL: http://svn.apache.org/r1480434
Log:
CTAKES-187 "Add template filler component to fill CEM-based templates". Add TemplateFillerAnnotator and aggregrate. Fills in degree of (severity) and location of from the relations discovered by relation-extractor
Added:
ctakes/trunk/ctakes-template-filler/desc/
ctakes/trunk/ctakes-template-filler/desc/analysis_engine/
ctakes/trunk/ctakes-template-filler/desc/analysis_engine/AggregateTemplateFiller.xml (with props)
ctakes/trunk/ctakes-template-filler/desc/analysis_engine/RelationExtractorAggregateWithoutOrangeBook.xml (with props)
ctakes/trunk/ctakes-template-filler/desc/analysis_engine/TemplateFillerAnnotator.xml (with props)
ctakes/trunk/ctakes-template-filler/src/main/java/org/
ctakes/trunk/ctakes-template-filler/src/main/java/org/apache/
ctakes/trunk/ctakes-template-filler/src/main/java/org/apache/ctakes/
ctakes/trunk/ctakes-template-filler/src/main/java/org/apache/ctakes/template/
ctakes/trunk/ctakes-template-filler/src/main/java/org/apache/ctakes/template/filler/
ctakes/trunk/ctakes-template-filler/src/main/java/org/apache/ctakes/template/filler/ae/
ctakes/trunk/ctakes-template-filler/src/main/java/org/apache/ctakes/template/filler/ae/TemplateFillerAnnotator.java (with props)
Modified:
ctakes/trunk/ctakes-template-filler/.project
ctakes/trunk/ctakes-template-filler/pom.xml
Modified: ctakes/trunk/ctakes-template-filler/.project
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-template-filler/.project?rev=1480434&r1=1480433&r2=1480434&view=diff
==============================================================================
--- ctakes/trunk/ctakes-template-filler/.project (original)
+++ ctakes/trunk/ctakes-template-filler/.project Wed May 8 20:05:44 2013
@@ -19,5 +19,6 @@
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
+ <nature>org.apache.uima.pear.UimaNature</nature>
</natures>
</projectDescription>
Added: ctakes/trunk/ctakes-template-filler/desc/analysis_engine/AggregateTemplateFiller.xml
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-template-filler/desc/analysis_engine/AggregateTemplateFiller.xml?rev=1480434&view=auto
==============================================================================
--- ctakes/trunk/ctakes-template-filler/desc/analysis_engine/AggregateTemplateFiller.xml (added)
+++ ctakes/trunk/ctakes-template-filler/desc/analysis_engine/AggregateTemplateFiller.xml Wed May 8 20:05:44 2013
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<analysisEngineDescription xmlns="http://uima.apache.org/resourceSpecifier">
+ <frameworkImplementation>org.apache.uima.java</frameworkImplementation>
+ <primitive>false</primitive>
+ <delegateAnalysisEngineSpecifiers>
+ <delegateAnalysisEngine key="RelationExtractorAnnotator">
+ <import location="RelationExtractorAggregateWithoutOrangeBook.xml"/>
+ </delegateAnalysisEngine>
+ <delegateAnalysisEngine key="TemplateFillerAnnotator">
+ <import location="TemplateFillerAnnotator.xml"/>
+ </delegateAnalysisEngine>
+ </delegateAnalysisEngineSpecifiers>
+ <analysisEngineMetaData>
+ <name>AggregateTemplateFiller</name>
+ <description>Find named entities and relations using RelationExtractor, then fill xxxxxxMention templates</description>
+ <version/>
+ <vendor/>
+ <configurationParameters searchStrategy="language_fallback">
+ </configurationParameters>
+ <configurationParameterSettings>
+ </configurationParameterSettings>
+ <flowConstraints>
+ <fixedFlow>
+ <node>RelationExtractorAnnotator</node>
+ <node>TemplateFillerAnnotator</node>
+ </fixedFlow>
+ </flowConstraints>
+ <typePriorities>
+ <name>Ordering</name>
+ <description>For subiterator</description>
+ <version>1.0</version>
+ <priorityList>
+ <type>org.apache.ctakes.typesystem.type.textspan.Segment</type>
+ <type>org.apache.ctakes.typesystem.type.textspan.Sentence</type>
+ <type>org.apache.ctakes.typesystem.type.syntax.BaseToken</type>
+ </priorityList>
+ <priorityList>
+ <type>org.apache.ctakes.typesystem.type.textspan.Sentence</type>
+ <type>org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation</type>
+ </priorityList>
+ </typePriorities>
+ <fsIndexCollection/>
+ <capabilities>
+ <capability>
+ <inputs/>
+ <outputs>
+ </outputs>
+ <languagesSupported/>
+ </capability>
+ </capabilities>
+ <operationalProperties>
+ <modifiesCas>true</modifiesCas>
+ <multipleDeploymentAllowed>true</multipleDeploymentAllowed>
+ <outputsNewCASes>false</outputsNewCASes>
+ </operationalProperties>
+ </analysisEngineMetaData>
+ <resourceManagerConfiguration/>
+</analysisEngineDescription>
Propchange: ctakes/trunk/ctakes-template-filler/desc/analysis_engine/AggregateTemplateFiller.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: ctakes/trunk/ctakes-template-filler/desc/analysis_engine/RelationExtractorAggregateWithoutOrangeBook.xml
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-template-filler/desc/analysis_engine/RelationExtractorAggregateWithoutOrangeBook.xml?rev=1480434&view=auto
==============================================================================
--- ctakes/trunk/ctakes-template-filler/desc/analysis_engine/RelationExtractorAggregateWithoutOrangeBook.xml (added)
+++ ctakes/trunk/ctakes-template-filler/desc/analysis_engine/RelationExtractorAggregateWithoutOrangeBook.xml Wed May 8 20:05:44 2013
@@ -0,0 +1,475 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<analysisEngineDescription xmlns="http://uima.apache.org/resourceSpecifier">
+ <frameworkImplementation>org.apache.uima.java</frameworkImplementation>
+ <primitive>false</primitive>
+ <delegateAnalysisEngineSpecifiers>
+ <delegateAnalysisEngine key="DrugMentionAnnotator">
+ <import location="../../../ctakes-drug-ner/desc/analysis_engine/DrugMentionAnnotator.xml"/>
+ </delegateAnalysisEngine>
+ <delegateAnalysisEngine key="DrugLookupWindowAnnotator">
+ <import location="../../../ctakes-drug-ner/desc/analysis_engine/DrugLookupWindowAnnotator.xml"/>
+ </delegateAnalysisEngine>
+ <delegateAnalysisEngine key="EntityMentionPairRelationExtractorAnnotator">
+ <analysisEngineDescription>
+ <frameworkImplementation>org.apache.uima.java</frameworkImplementation>
+ <primitive>true</primitive>
+ <annotatorImplementationName>org.apache.ctakes.relationextractor.ae.EntityMentionPairRelationExtractorAnnotator</annotatorImplementationName>
+ <analysisEngineMetaData>
+ <name>EntityMentionPairRelationExtractorAnnotator</name>
+ <description>Descriptor automatically generated by uimaFIT</description>
+ <version>unknown</version>
+ <vendor>org.apache.ctakes.relationextractor.ae</vendor>
+ <configurationParameters>
+ <configurationParameter>
+ <name>ClassifyBothDirections</name>
+ <description>run the classifier in both directions, that is, classify each pair of events {X,Y} once in the order X-to-Y and once in the order Y-to-X (default: classify each pair of events {X, Y} once, giving the label 'R' if a relation exists with the order X-to-Y, and 'R-1' if a relation exists with the order Y-to-X)</description>
+ <type>Boolean</type>
+ <multiValued>false</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>ProbabilityOfKeepingANegativeExample</name>
+ <description>probability that a negative example should be retained for training</description>
+ <type>Float</type>
+ <multiValued>false</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>org.cleartk.classifier.CleartkAnnotator.classifierFactoryClassName</name>
+ <description>provides the full name of the ClassifierFactory class to be used.</description>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>org.cleartk.classifier.CleartkAnnotator.dataWriterFactoryClassName</name>
+ <description>provides the full name of the DataWriterFactory class to be used.</description>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>org.cleartk.classifier.CleartkAnnotator.isTraining</name>
+ <description>determines whether this annotator is writing training data or using a classifier to annotate. Normally inferred automatically based on whether or not a DataWriterFactory class has been set.</description>
+ <type>Boolean</type>
+ <multiValued>false</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>org.cleartk.classifier.jar.GenericJarClassifierFactory.classifierJarPath</name>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ </configurationParameters>
+ <configurationParameterSettings>
+ <nameValuePair>
+ <name>org.cleartk.classifier.CleartkAnnotator.classifierFactoryClassName</name>
+ <value>
+ <string>org.cleartk.classifier.jar.JarClassifierFactory</string>
+ </value>
+ </nameValuePair>
+ <nameValuePair>
+ <name>org.cleartk.classifier.CleartkAnnotator.dataWriterFactoryClassName</name>
+ <value>
+ <string>org.cleartk.classifier.jar.DefaultDataWriterFactory</string>
+ </value>
+ </nameValuePair>
+ <nameValuePair>
+ <name>ProbabilityOfKeepingANegativeExample</name>
+ <value>
+ <float>0.5</float>
+ </value>
+ </nameValuePair>
+ <nameValuePair>
+ <name>org.cleartk.classifier.jar.GenericJarClassifierFactory.classifierJarPath</name>
+ <value>
+ <string>/org/apache/ctakes/relationextractor/models/em_pair/model.jar</string>
+ </value>
+ </nameValuePair>
+ <nameValuePair>
+ <name>ClassifyBothDirections</name>
+ <value>
+ <boolean>false</boolean>
+ </value>
+ </nameValuePair>
+ </configurationParameterSettings>
+ <typeSystemDescription>
+ <imports>
+ <import name="org.apache.ctakes.typesystem.types.TypeSystem"/>
+ </imports>
+ </typeSystemDescription>
+ <fsIndexCollection/>
+ <capabilities/>
+ <operationalProperties>
+ <modifiesCas>true</modifiesCas>
+ <multipleDeploymentAllowed>true</multipleDeploymentAllowed>
+ <outputsNewCASes>false</outputsNewCASes>
+ </operationalProperties>
+ </analysisEngineMetaData>
+ </analysisEngineDescription>
+ </delegateAnalysisEngine>
+ <delegateAnalysisEngine key="RelationExtractorPreprocessor">
+ <analysisEngineDescription>
+ <frameworkImplementation>org.apache.uima.java</frameworkImplementation>
+ <primitive>false</primitive>
+ <delegateAnalysisEngineSpecifiers>
+ <delegateAnalysisEngine key="DrugMentionAnnotator">
+ <import location="../../../ctakes-drug-ner/desc/analysis_engine/DrugMentionAnnotator.xml"/>
+ </delegateAnalysisEngine>
+ <delegateAnalysisEngine key="DrugLookupWindowAnnotator">
+ <import location="../../../ctakes-drug-ner/desc/analysis_engine/DrugLookupWindowAnnotator.xml"/>
+ </delegateAnalysisEngine>
+ <delegateAnalysisEngine key="TokenizerAnnotator">
+ <import location="../../../ctakes-core/desc/analysis_engine/TokenizerAnnotator.xml"/>
+ </delegateAnalysisEngine>
+ <delegateAnalysisEngine key="ContextDependentTokenizerAnnotator">
+ <import location="../../../ctakes-context-tokenizer/desc/analysis_engine/ContextDependentTokenizerAnnotator.xml"/>
+ </delegateAnalysisEngine>
+ <delegateAnalysisEngine key="ConstituencyParser">
+ <import location="../../../ctakes-constituency-parser/desc/ConstituencyParserAnnotator.xml"/>
+ </delegateAnalysisEngine>
+ <delegateAnalysisEngine key="StatusAnnotator">
+ <import location="../../../ctakes-ne-contexts/desc/StatusAnnotator.xml"/>
+ </delegateAnalysisEngine>
+ <delegateAnalysisEngine key="NegationAnnotator">
+ <import location="../../../ctakes-ne-contexts/desc/NegationAnnotator.xml"/>
+ </delegateAnalysisEngine>
+ <delegateAnalysisEngine key="SentenceDetectorAnnotator">
+ <import location="../../../ctakes-core/desc/analysis_engine/SentenceDetectorAnnotator.xml"/>
+ </delegateAnalysisEngine>
+ <delegateAnalysisEngine key="AdjustNounPhraseToIncludeFollowingNP">
+ <import location="../../../ctakes-chunker/desc/AdjustNounPhraseToIncludeFollowingNP.xml"/>
+ </delegateAnalysisEngine>
+ <delegateAnalysisEngine key="AdjustNounPhraseToIncludeFollowingPPNP">
+ <import location="../../../ctakes-chunker/desc/AdjustNounPhraseToIncludeFollowingPPNP.xml"/>
+ </delegateAnalysisEngine>
+ <delegateAnalysisEngine key="SimpleSegmentAnnotator">
+ <import location="../../../ctakes-clinical-pipeline/desc/analysis_engine/SimpleSegmentAnnotator.xml"/>
+ </delegateAnalysisEngine>
+ <delegateAnalysisEngine key="POSTagger">
+ <import location="../../../ctakes-pos-tagger/desc/POSTagger.xml"/>
+ </delegateAnalysisEngine>
+ <delegateAnalysisEngine key="Chunker">
+ <import location="../../../ctakes-chunker/desc/Chunker.xml"/>
+ </delegateAnalysisEngine>
+ <delegateAnalysisEngine key="ClearNLPAE">
+ <import location="../../../ctakes-dependency-parser/desc/analysis_engine/ClearNLPDependencyParserAE.xml"/>
+ </delegateAnalysisEngine>
+ <delegateAnalysisEngine key="DictionaryLookupAnnotatorDB">
+ <import location="../../../ctakes-dictionary-lookup/desc/analysis_engine/DictionaryLookupAnnotatorUMLS.xml"/>
+ </delegateAnalysisEngine>
+ <delegateAnalysisEngine key="ExtractionPrepAnnotator">
+ <import location="../../../ctakes-clinical-pipeline/desc/analysis_engine/ExtractionPrepAnnotator.xml"/>
+ </delegateAnalysisEngine>
+ <delegateAnalysisEngine key="LookupWindowAnnotator">
+ <import location="../../../ctakes-clinical-pipeline/desc/analysis_engine/LookupWindowAnnotator.xml"/>
+ </delegateAnalysisEngine>
+ <delegateAnalysisEngine key="LvgAnnotator">
+ <import location="../../../ctakes-lvg/desc/analysis_engine/LvgAnnotator.xml"/>
+ </delegateAnalysisEngine>
+ </delegateAnalysisEngineSpecifiers>
+ <analysisEngineMetaData>
+ <name>RelationExtractorPreprocessor</name>
+ <description>Same as AggregateRelationExtractorUMLSProcessor, without the RelationExtractorAnnotator.</description>
+ <version/>
+ <vendor/>
+ <configurationParameters searchStrategy="language_fallback">
+ <configurationParameter>
+ <name>SegmentID</name>
+ <description/>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>false</mandatory>
+ <overrides>
+ <parameter>SimpleSegmentAnnotator/SegmentID</parameter>
+ </overrides>
+ </configurationParameter>
+ <configurationParameter>
+ <name>ChunkCreatorClass</name>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>true</mandatory>
+ <overrides>
+ <parameter>Chunker/ChunkCreatorClass</parameter>
+ </overrides>
+ </configurationParameter>
+ </configurationParameters>
+ <configurationParameterSettings>
+ <nameValuePair>
+ <name>ChunkCreatorClass</name>
+ <value>
+ <string>org.apache.ctakes.chunker.ae.PhraseTypeChunkCreator</string>
+ </value>
+ </nameValuePair>
+ </configurationParameterSettings>
+ <flowConstraints>
+ <fixedFlow>
+ <node>SimpleSegmentAnnotator</node>
+ <node>SentenceDetectorAnnotator</node>
+ <node>TokenizerAnnotator</node>
+ <node>LvgAnnotator</node>
+ <node>ContextDependentTokenizerAnnotator</node>
+ <node>POSTagger</node>
+ <node>ConstituencyParser</node>
+ <node>ClearNLPAE</node>
+ <node>Chunker</node>
+ <node>AdjustNounPhraseToIncludeFollowingNP</node>
+ <node>AdjustNounPhraseToIncludeFollowingPPNP</node>
+ <node>LookupWindowAnnotator</node>
+ <node>DrugLookupWindowAnnotator</node>
+ <node>DictionaryLookupAnnotatorDB</node>
+ <node>DrugMentionAnnotator</node>
+ <node>NegationAnnotator</node>
+ <node>ExtractionPrepAnnotator</node>
+ </fixedFlow>
+ </flowConstraints>
+ <typePriorities>
+ <name>Ordering</name>
+ <description>For subiterator</description>
+ <version>1.0</version>
+ <priorityList>
+ <type>org.apache.ctakes.typesystem.type.textspan.Segment</type>
+ <type>org.apache.ctakes.typesystem.type.textspan.Sentence</type>
+ <type>org.apache.ctakes.typesystem.type.syntax.BaseToken</type>
+ </priorityList>
+ <priorityList>
+ <type>org.apache.ctakes.typesystem.type.textspan.Sentence</type>
+ <type>org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation</type>
+ </priorityList>
+ </typePriorities>
+ <fsIndexCollection/>
+ <capabilities>
+ <capability>
+ <inputs/>
+ <outputs>
+ <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.syntax.NewlineToken</type>
+ <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation</type>
+ <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.syntax.WordToken</type>
+ <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.syntax.VP</type>
+ <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.refsem.UmlsConcept</type>
+ <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.syntax.UCP</type>
+ <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.textsem.TimeAnnotation</type>
+ <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.syntax.SymbolToken</type>
+ <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.textspan.Sentence</type>
+ <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.syntax.SBAR</type>
+ <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.textsem.RomanNumeralAnnotation</type>
+ <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.textsem.RangeAnnotation</type>
+ <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.syntax.PunctuationToken</type>
+ <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.textsem.PersonTitleAnnotation</type>
+ <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.syntax.PRT</type>
+ <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.syntax.PP</type>
+ <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.syntax.NumToken</type>
+ <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.textsem.MeasurementAnnotation</type>
+ <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.syntax.Lemma</type>
+ <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.syntax.LST</type>
+ <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.syntax.INTJ</type>
+ <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.textsem.FractionAnnotation</type>
+ <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.structured.DocumentID</type>
+ <type allAnnotatorFeatures="true">uima.tcas.DocumentAnnotation</type>
+ <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.textsem.DateAnnotation</type>
+ <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.CopySrcAnnotation</type>
+ <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.CopyDestAnnotation</type>
+ <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.textsem.ContextAnnotation</type>
+ <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.syntax.Chunk</type>
+ <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.syntax.CONJP</type>
+ <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.syntax.BaseToken</type>
+ <type allAnnotatorFeatures="true">uima.cas.AnnotationBase</type>
+ <type allAnnotatorFeatures="true">uima.tcas.Annotation</type>
+ <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.syntax.ADVP</type>
+ <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.syntax.ADJP</type>
+ </outputs>
+ <languagesSupported/>
+ </capability>
+ </capabilities>
+ <operationalProperties>
+ <modifiesCas>true</modifiesCas>
+ <multipleDeploymentAllowed>true</multipleDeploymentAllowed>
+ <outputsNewCASes>false</outputsNewCASes>
+ </operationalProperties>
+ </analysisEngineMetaData>
+ <resourceManagerConfiguration/>
+ </analysisEngineDescription>
+ </delegateAnalysisEngine>
+ <delegateAnalysisEngine key="DegreeOfRelationExtractorAnnotator">
+ <analysisEngineDescription>
+ <frameworkImplementation>org.apache.uima.java</frameworkImplementation>
+ <primitive>true</primitive>
+ <annotatorImplementationName>org.apache.ctakes.relationextractor.ae.DegreeOfRelationExtractorAnnotator</annotatorImplementationName>
+ <analysisEngineMetaData>
+ <name>DegreeOfRelationExtractorAnnotator</name>
+ <description>Descriptor automatically generated by uimaFIT</description>
+ <version>unknown</version>
+ <vendor>org.apache.ctakes.relationextractor.ae</vendor>
+ <configurationParameters>
+ <configurationParameter>
+ <name>ProbabilityOfKeepingANegativeExample</name>
+ <description>probability that a negative example should be retained for training</description>
+ <type>Float</type>
+ <multiValued>false</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>org.cleartk.classifier.CleartkAnnotator.classifierFactoryClassName</name>
+ <description>provides the full name of the ClassifierFactory class to be used.</description>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>org.cleartk.classifier.CleartkAnnotator.dataWriterFactoryClassName</name>
+ <description>provides the full name of the DataWriterFactory class to be used.</description>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>org.cleartk.classifier.CleartkAnnotator.isTraining</name>
+ <description>determines whether this annotator is writing training data or using a classifier to annotate. Normally inferred automatically based on whether or not a DataWriterFactory class has been set.</description>
+ <type>Boolean</type>
+ <multiValued>false</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>org.cleartk.classifier.jar.GenericJarClassifierFactory.classifierJarPath</name>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ </configurationParameters>
+ <configurationParameterSettings>
+ <nameValuePair>
+ <name>org.cleartk.classifier.CleartkAnnotator.classifierFactoryClassName</name>
+ <value>
+ <string>org.cleartk.classifier.jar.JarClassifierFactory</string>
+ </value>
+ </nameValuePair>
+ <nameValuePair>
+ <name>org.cleartk.classifier.CleartkAnnotator.dataWriterFactoryClassName</name>
+ <value>
+ <string>org.cleartk.classifier.jar.DefaultDataWriterFactory</string>
+ </value>
+ </nameValuePair>
+ <nameValuePair>
+ <name>ProbabilityOfKeepingANegativeExample</name>
+ <value>
+ <float>1.0</float>
+ </value>
+ </nameValuePair>
+ <nameValuePair>
+ <name>org.cleartk.classifier.jar.GenericJarClassifierFactory.classifierJarPath</name>
+ <value>
+ <string>/org/apache/ctakes/relationextractor/models/degree_of/model.jar</string>
+ </value>
+ </nameValuePair>
+ </configurationParameterSettings>
+ <typeSystemDescription>
+ <imports>
+ <import name="org.apache.ctakes.typesystem.types.TypeSystem"/>
+ </imports>
+ </typeSystemDescription>
+ <fsIndexCollection/>
+ <capabilities/>
+ <operationalProperties>
+ <modifiesCas>true</modifiesCas>
+ <multipleDeploymentAllowed>true</multipleDeploymentAllowed>
+ <outputsNewCASes>false</outputsNewCASes>
+ </operationalProperties>
+ </analysisEngineMetaData>
+ </analysisEngineDescription>
+ </delegateAnalysisEngine>
+ <delegateAnalysisEngine key="ModifierExtractorAnnotator">
+ <analysisEngineDescription>
+ <frameworkImplementation>org.apache.uima.java</frameworkImplementation>
+ <primitive>true</primitive>
+ <annotatorImplementationName>org.apache.ctakes.relationextractor.ae.ModifierExtractorAnnotator</annotatorImplementationName>
+ <analysisEngineMetaData>
+ <name>ModifierExtractorAnnotator</name>
+ <description>Descriptor automatically generated by uimaFIT</description>
+ <version>unknown</version>
+ <vendor>org.apache.ctakes.relationextractor.ae</vendor>
+ <configurationParameters>
+ <configurationParameter>
+ <name>org.cleartk.classifier.CleartkAnnotator.classifierFactoryClassName</name>
+ <description>provides the full name of the ClassifierFactory class to be used.</description>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>org.cleartk.classifier.CleartkAnnotator.dataWriterFactoryClassName</name>
+ <description>provides the full name of the DataWriterFactory class to be used.</description>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>org.cleartk.classifier.CleartkAnnotator.isTraining</name>
+ <description>determines whether this annotator is writing training data or using a classifier to annotate. Normally inferred automatically based on whether or not a DataWriterFactory class has been set.</description>
+ <type>Boolean</type>
+ <multiValued>false</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>org.cleartk.classifier.jar.GenericJarClassifierFactory.classifierJarPath</name>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ </configurationParameters>
+ <configurationParameterSettings>
+ <nameValuePair>
+ <name>org.cleartk.classifier.CleartkAnnotator.classifierFactoryClassName</name>
+ <value>
+ <string>org.cleartk.classifier.jar.JarClassifierFactory</string>
+ </value>
+ </nameValuePair>
+ <nameValuePair>
+ <name>org.cleartk.classifier.CleartkAnnotator.dataWriterFactoryClassName</name>
+ <value>
+ <string>org.cleartk.classifier.jar.DefaultDataWriterFactory</string>
+ </value>
+ </nameValuePair>
+ <nameValuePair>
+ <name>org.cleartk.classifier.jar.GenericJarClassifierFactory.classifierJarPath</name>
+ <value>
+ <string>/org/apache/ctakes/relationextractor/models/modifier_extractor/model.jar</string>
+ </value>
+ </nameValuePair>
+ </configurationParameterSettings>
+ <typeSystemDescription>
+ <imports>
+ <import name="org.apache.ctakes.typesystem.types.TypeSystem"/>
+ </imports>
+ </typeSystemDescription>
+ <fsIndexCollection/>
+ <capabilities/>
+ <operationalProperties>
+ <modifiesCas>true</modifiesCas>
+ <multipleDeploymentAllowed>true</multipleDeploymentAllowed>
+ <outputsNewCASes>false</outputsNewCASes>
+ </operationalProperties>
+ </analysisEngineMetaData>
+ </analysisEngineDescription>
+ </delegateAnalysisEngine>
+ </delegateAnalysisEngineSpecifiers>
+ <analysisEngineMetaData>
+ <name>RelationExtractorAggregate</name>
+ <configurationParameters/>
+ <configurationParameterSettings/>
+ <flowConstraints>
+ <fixedFlow>
+ <node>RelationExtractorPreprocessor</node>
+ <node>ModifierExtractorAnnotator</node>
+ <node>DegreeOfRelationExtractorAnnotator</node>
+ <node>EntityMentionPairRelationExtractorAnnotator</node>
+ </fixedFlow>
+ </flowConstraints>
+ <capabilities/>
+ <operationalProperties>
+ <modifiesCas>true</modifiesCas>
+ <multipleDeploymentAllowed>true</multipleDeploymentAllowed>
+ <outputsNewCASes>false</outputsNewCASes>
+ </operationalProperties>
+ </analysisEngineMetaData>
+</analysisEngineDescription>
Propchange: ctakes/trunk/ctakes-template-filler/desc/analysis_engine/RelationExtractorAggregateWithoutOrangeBook.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: ctakes/trunk/ctakes-template-filler/desc/analysis_engine/TemplateFillerAnnotator.xml
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-template-filler/desc/analysis_engine/TemplateFillerAnnotator.xml?rev=1480434&view=auto
==============================================================================
--- ctakes/trunk/ctakes-template-filler/desc/analysis_engine/TemplateFillerAnnotator.xml (added)
+++ ctakes/trunk/ctakes-template-filler/desc/analysis_engine/TemplateFillerAnnotator.xml Wed May 8 20:05:44 2013
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<analysisEngineDescription xmlns="http://uima.apache.org/resourceSpecifier">
+ <frameworkImplementation>org.apache.uima.java</frameworkImplementation>
+ <primitive>true</primitive>
+ <annotatorImplementationName>org.apache.ctakes.template.filler.ae.TemplateFillerAnnotator</annotatorImplementationName>
+ <analysisEngineMetaData>
+ <name>TemplateFillerAnnotator</name>
+ <description></description>
+ <version>unknown</version>
+ <vendor></vendor>
+ <configurationParameters>
+ </configurationParameters>
+ <configurationParameterSettings>
+ </configurationParameterSettings>
+ <typeSystemDescription/>
+ <fsIndexCollection/>
+ <capabilities/>
+ <operationalProperties>
+ <modifiesCas>true</modifiesCas>
+ <multipleDeploymentAllowed>true</multipleDeploymentAllowed>
+ <outputsNewCASes>false</outputsNewCASes>
+ </operationalProperties>
+ </analysisEngineMetaData>
+</analysisEngineDescription>
Propchange: ctakes/trunk/ctakes-template-filler/desc/analysis_engine/TemplateFillerAnnotator.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: ctakes/trunk/ctakes-template-filler/pom.xml
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-template-filler/pom.xml?rev=1480434&r1=1480433&r2=1480434&view=diff
==============================================================================
--- ctakes/trunk/ctakes-template-filler/pom.xml (original)
+++ ctakes/trunk/ctakes-template-filler/pom.xml Wed May 8 20:05:44 2013
@@ -48,6 +48,10 @@
</dependency>
<dependency>
<groupId>org.apache.ctakes</groupId>
+ <artifactId>ctakes-clinical-pipeline</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ctakes</groupId>
<artifactId>ctakes-relation-extractor</artifactId>
</dependency>
<dependency>
Added: ctakes/trunk/ctakes-template-filler/src/main/java/org/apache/ctakes/template/filler/ae/TemplateFillerAnnotator.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-template-filler/src/main/java/org/apache/ctakes/template/filler/ae/TemplateFillerAnnotator.java?rev=1480434&view=auto
==============================================================================
--- ctakes/trunk/ctakes-template-filler/src/main/java/org/apache/ctakes/template/filler/ae/TemplateFillerAnnotator.java (added)
+++ ctakes/trunk/ctakes-template-filler/src/main/java/org/apache/ctakes/template/filler/ae/TemplateFillerAnnotator.java Wed May 8 20:05:44 2013
@@ -0,0 +1,391 @@
+package org.apache.ctakes.template.filler.ae;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+import org.apache.uima.UimaContext;
+import org.apache.uima.analysis_component.JCasAnnotator_ImplBase;
+import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
+import org.apache.uima.cas.CASException;
+import org.apache.uima.cas.FSIndex;
+import org.apache.uima.cas.FSIndexRepository;
+import org.apache.uima.cas.FSIterator;
+import org.apache.uima.cas.Feature;
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.impl.FeatureImpl;
+import org.apache.uima.cas.text.AnnotationIndex;
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JFSIndexRepository;
+import org.apache.uima.jcas.tcas.Annotation;
+import org.apache.uima.resource.ResourceInitializationException;
+import org.apache.ctakes.typesystem.type.constants.CONST;
+
+import org.apache.ctakes.typesystem.type.refsem.Date;
+import org.apache.ctakes.typesystem.type.refsem.MedicationDosage;
+import org.apache.ctakes.typesystem.type.refsem.MedicationDuration;
+import org.apache.ctakes.typesystem.type.refsem.MedicationForm;
+import org.apache.ctakes.typesystem.type.refsem.MedicationFrequency;
+import org.apache.ctakes.typesystem.type.refsem.MedicationRoute;
+import org.apache.ctakes.typesystem.type.refsem.MedicationStatusChange;
+import org.apache.ctakes.typesystem.type.refsem.MedicationStrength;
+import org.apache.ctakes.typesystem.type.refsem.Severity;
+import org.apache.ctakes.typesystem.type.relation.BinaryTextRelation;
+import org.apache.ctakes.typesystem.type.relation.DegreeOfTextRelation;
+import org.apache.ctakes.typesystem.type.relation.LocationOfTextRelation;
+import org.apache.ctakes.typesystem.type.relation.RelationArgument;
+import org.apache.ctakes.typesystem.type.textsem.AnatomicalSiteMention;
+import org.apache.ctakes.typesystem.type.textsem.DiseaseDisorderMention;
+import org.apache.ctakes.typesystem.type.textsem.EntityMention;
+import org.apache.ctakes.typesystem.type.textsem.EventMention;
+import org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation;
+import org.apache.ctakes.typesystem.type.textsem.MedicationDosageModifier;
+import org.apache.ctakes.typesystem.type.textsem.MedicationDurationModifier;
+import org.apache.ctakes.typesystem.type.textsem.MedicationEventMention;
+import org.apache.ctakes.typesystem.type.textsem.MedicationFormModifier;
+import org.apache.ctakes.typesystem.type.textsem.MedicationFrequencyModifier;
+import org.apache.ctakes.typesystem.type.textsem.MedicationMention;
+import org.apache.ctakes.typesystem.type.textsem.MedicationRouteModifier;
+import org.apache.ctakes.typesystem.type.textsem.MedicationStatusChangeModifier;
+import org.apache.ctakes.typesystem.type.textsem.MedicationStrengthModifier;
+import org.apache.ctakes.typesystem.type.textsem.Modifier;
+import org.apache.ctakes.typesystem.type.textsem.ProcedureMention;
+import org.apache.ctakes.typesystem.type.textsem.SignSymptomMention;
+import org.apache.ctakes.typesystem.type.textsem.TimeMention;
+
+public class TemplateFillerAnnotator extends JCasAnnotator_ImplBase{
+
+ // LOG4J logger based on class name
+ private Logger logger = Logger.getLogger(getClass().getName());
+ private UimaContext uimaContext;
+
+
+ @Override
+ public void initialize(UimaContext aContext) throws ResourceInitializationException {
+
+ super.initialize(aContext);
+ uimaContext = aContext;
+
+ logger.info("Initializing " + TemplateFillerAnnotator.class.getName());
+
+ }
+
+ /**
+ * Copy values from <tt>original</tt> to <tt>mention</tt> and add <tt>mention</tt> to the indexes.
+ * If <tt>original</tt> is a MedicationEventMention (which used to be created by ctakes-drug-ner),
+ * create a MedicationMention from the MedicationEventMention, setting the MedicationMention specific
+ * attributes like dosage from the MedicationEventMention attributes.
+ * @param mention The annotation to copy values to
+ * @param original The annotation to copy values from
+ * @throws CASException
+ */
+ private void setAttributesFromOriginal(IdentifiedAnnotation mention, IdentifiedAnnotation original) throws CASException {
+ mention.setBegin(original.getBegin());
+ mention.setEnd(original.getEnd());
+ mention.setConditional(original.getConditional());
+ mention.setConfidence(original.getConfidence());
+ mention.setDiscoveryTechnique(original.getDiscoveryTechnique());
+ mention.setGeneric(original.getGeneric());
+ mention.setOntologyConceptArr(original.getOntologyConceptArr());
+ mention.setPolarity(original.getPolarity());
+ mention.setSegmentID(original.getSegmentID());
+ mention.setSentenceID(original.getSentenceID());
+ mention.setSubject(original.getSubject());
+ mention.setTypeID(original.getTypeID());
+ mention.setUncertainty(original.getUncertainty());
+ mention.setHistoryOf(original.getHistoryOf());
+
+
+ if (original instanceof MedicationEventMention) {
+ MedicationEventMention medEventMention = (MedicationEventMention) original;
+ MedicationMention medMention = (MedicationMention) mention;
+ JCas jcas = medMention.getCAS().getJCas();
+ if (medEventMention.getStartDate()!=null) {
+ Date date = medEventMention.getStartDate();
+ TimeMention timeMention = new TimeMention(jcas);
+ timeMention.setDate(date);
+ medMention.setStartDate(timeMention);
+ }
+ if (medEventMention.getEndDate()!=null) {
+ Date date = medEventMention.getEndDate();
+ TimeMention timeMention = new TimeMention(jcas);
+ timeMention.setDate(date);
+ medMention.setEndDate(timeMention);
+ }
+ if (medEventMention.getMedicationDosage()!=null) {
+ MedicationDosage dosage = medEventMention.getMedicationDosage();
+ MedicationDosageModifier medDosageModifier = new MedicationDosageModifier(jcas);
+ medDosageModifier.setNormalizedForm(dosage);
+ medDosageModifier.setCategory(dosage.getValue());
+ medMention.setMedicationDosage(medDosageModifier);
+
+ }
+ if (medEventMention.getMedicationDuration()!=null) {
+ MedicationDuration duration = medEventMention.getMedicationDuration();
+ MedicationDurationModifier medDurationModifier = new MedicationDurationModifier(jcas);
+ medDurationModifier.setNormalizedForm(duration);
+ medDurationModifier.setCategory(duration.getValue());
+ medMention.setMedicationDuration(medDurationModifier);
+ }
+ if (medEventMention.getMedicationForm()!=null) {
+ MedicationForm form = medEventMention.getMedicationForm();
+ MedicationFormModifier medFormModifier = new MedicationFormModifier(jcas);
+ medFormModifier.setNormalizedForm(form);
+ medFormModifier.setCategory(form.getValue());
+ medMention.setMedicationForm(medFormModifier);
+ }
+ if (medEventMention.getMedicationFrequency()!=null) {
+ MedicationFrequency frequency = medEventMention.getMedicationFrequency();
+ MedicationFrequencyModifier medFrequencyModifier = new MedicationFrequencyModifier(jcas);
+ medFrequencyModifier.setNormalizedForm(frequency);
+ medFrequencyModifier.setCategory(frequency.getNumber() + frequency.getUnit());
+ medMention.setMedicationFrequency(medFrequencyModifier);
+ }
+ if (medEventMention.getMedicationRoute()!=null) {
+ MedicationRoute route = medEventMention.getMedicationRoute();
+ MedicationRouteModifier medRouteModifier = new MedicationRouteModifier(jcas);
+ medRouteModifier.setNormalizedForm(route);
+ medRouteModifier.setCategory(route.getValue());
+ medMention.setMedicationRoute(medRouteModifier);
+ }
+ if (medEventMention.getMedicationStatusChange()!=null) {
+ MedicationStatusChange statusChange = medEventMention.getMedicationStatusChange();
+ MedicationStatusChangeModifier medStatusChangeModifier = new MedicationStatusChangeModifier(jcas);
+ medStatusChangeModifier.setNormalizedForm(statusChange);
+ medStatusChangeModifier.setCategory(statusChange.getValue());
+ medMention.setMedicationStatusChange(medStatusChangeModifier);
+ }
+ if (medEventMention.getMedicationStrength()!=null) {
+ MedicationStrength strength = medEventMention.getMedicationStrength();
+ MedicationStrengthModifier medStrengthModifier = new MedicationStrengthModifier(jcas);
+ medStrengthModifier.setNormalizedForm(strength);
+ medStrengthModifier.setCategory(strength.getNumber() + strength.getUnit());
+ medMention.setMedicationStrength(medStrengthModifier);
+ }
+
+ // TODO handle MedicationAllergyModifier here when / if the value is set/disovered some day
+
+ }
+
+ mention.addToIndexes();
+
+ }
+
+ @Override
+ public void process(JCas jcas) throws AnalysisEngineProcessException {
+
+ logger.debug("process(JCas) in " + TemplateFillerAnnotator.class.getName());
+
+ // Get all IdentifiedAnnotations
+ FSIterator<Annotation> identifiedAnnotationsIter = getAllAnnotations(jcas, IdentifiedAnnotation.type);
+
+ Map<IdentifiedAnnotation, IdentifiedAnnotation> mapToMentions = new HashMap<IdentifiedAnnotation, IdentifiedAnnotation>();
+
+ // For each IdentifiedAnnotations, if it is of one of the right types, copy to the appropriate new subtype
+ List<Annotation> annotationsToRemoveFromCas = new ArrayList<Annotation>();
+ try {
+ while (identifiedAnnotationsIter.hasNext()) {
+ IdentifiedAnnotation original = (IdentifiedAnnotation)identifiedAnnotationsIter.next();
+ IdentifiedAnnotation mention = null;
+ if (true) {
+ // for 3.0 and earlier, needed to map mentions to the more specific types. in post-3.0, already creating proper type
+ // for things other than medications. Drug NER was creating MedicationEventMentions still for a while (in trunk)
+ int t = original.getTypeID();
+ if (t==CONST.NE_TYPE_ID_ANATOMICAL_SITE || t==CONST.NE_TYPE_ID_DISORDER || t==CONST.NE_TYPE_ID_DISORDER
+ || t==CONST.NE_TYPE_ID_FINDING || t==CONST.NE_TYPE_ID_PROCEDURE) {
+ mapToMentions.put(original, original); // with 3.1 don't need to map to proper mention type, already creating as proper type
+ } else if (t==CONST.NE_TYPE_ID_DRUG) {
+ // Drug NER (ctakes-drug-ner) was creating MedicationEventMention,
+ // if found, create MedicationMention with its attributes based on the MedicationEventMention attributes
+ if (original instanceof MedicationEventMention) {
+ mention = new MedicationMention(jcas);
+ mapToMentions.put(original, mention);
+ setAttributesFromOriginal(mention, original);
+ annotationsToRemoveFromCas.add(original);
+ }
+
+ } else {
+ // Some other type of IdentifiedAnnotation such as TimeMention, Modifier, DateMention, RomanNumeralAnnotation, etc
+ // For each those we do nothing in this annotator.
+ }
+ } else {
+ // This switch should no longer be needed now that with 3.1 we are using correct specific types like
+ // AnatomicalSiteMention rather than EntityMention and DiseaseDisorderMention etc
+ switch (original.getTypeID()) {
+
+ case CONST.NE_TYPE_ID_ANATOMICAL_SITE: ;
+ //org.apache.ctakes.typesystem.type.textsem.AnatomicalSiteMention
+ //org.apache.ctakes.typesystem.type.textsem.EntityMention
+ mention = new AnatomicalSiteMention(jcas);
+ mapToMentions.put(original, mention);
+ setAttributesFromOriginal(mention, original);
+ annotationsToRemoveFromCas.add(original);
+ break;
+
+ case CONST.NE_TYPE_ID_DISORDER: ;
+ //org.apache.ctakes.typesystem.type.textsem.DiseaseDisorderMention
+ //org.apache.ctakes.typesystem.type.textsem.EventMention
+ mention = new DiseaseDisorderMention(jcas);
+ mapToMentions.put(original, mention);
+ setAttributesFromOriginal(mention, original);
+ annotationsToRemoveFromCas.add(original);
+ break;
+
+ case CONST.NE_TYPE_ID_DRUG: ;
+
+ if (original instanceof MedicationEventMention) {
+ mention = new MedicationMention(jcas);
+ mapToMentions.put(original, mention);
+ setAttributesFromOriginal(mention, original);
+ annotationsToRemoveFromCas.add(original);
+ }
+ break;
+
+ case CONST.NE_TYPE_ID_FINDING: ; // aka sign/symptom
+ //org.apache.ctakes.typesystem.type.textsem.SignSymptomMention
+ //org.apache.ctakes.typesystem.type.textsem.EventMention
+ mention = new SignSymptomMention(jcas);
+ mapToMentions.put(original, mention);
+ setAttributesFromOriginal(mention, original);
+ annotationsToRemoveFromCas.add(original);
+ break;
+
+ case CONST.NE_TYPE_ID_PROCEDURE: ;
+ //org.apache.ctakes.typesystem.type.textsem.ProcedureMention
+ //org.apache.ctakes.typesystem.type.textsem.EventMention
+ mention = new ProcedureMention(jcas);
+ mapToMentions.put(original, mention);
+ setAttributesFromOriginal(mention, original);
+ annotationsToRemoveFromCas.add(original);
+ break;
+
+ default: ;
+ // Some other type of IdentifiedAnnotation such as TimeMention, Modifier, DateMention, RomanNumeralAnnotation, etc
+ // For each those we do nothing in this annotator.
+ }
+ }
+ }
+
+ } catch (CASException e) {
+ throw new AnalysisEngineProcessException(e);
+ }
+
+ // Fill in template slots from relations.
+
+ //FSIndex<FeatureStructure> relationArgs = jcas.getFSIndexRepository().getIndex("_org.apache.ctakes.typesystem.type.relation.RelationArgument_GeneratedIndex");
+ FSIndex<FeatureStructure> binaryTextRelations = jcas.getFSIndexRepository().getIndex("_org.apache.ctakes.typesystem.type.relation.BinaryTextRelation_GeneratedIndex");
+ int i = 0;
+
+ if (binaryTextRelations != null) {
+
+ for (FeatureStructure binaryTextRelationFS: binaryTextRelations) {
+
+ i++;
+ //logger.info("binaryTextRelationFS = " + binaryTextRelationFS);
+ BinaryTextRelation binaryTextRelation = (BinaryTextRelation) binaryTextRelationFS;
+ LocationOfTextRelation locationOfTextRelation = null;
+ DegreeOfTextRelation degreeOfTextRelation = null;
+ if (binaryTextRelation instanceof LocationOfTextRelation) {
+ locationOfTextRelation = (LocationOfTextRelation) binaryTextRelationFS;
+ } else if (binaryTextRelation instanceof DegreeOfTextRelation) {
+ degreeOfTextRelation = (DegreeOfTextRelation) binaryTextRelationFS;
+ }
+
+ RelationArgument arg1 = binaryTextRelation.getArg1(); // an EntityMention OR location
+ RelationArgument arg2 = binaryTextRelation.getArg2(); // a Modifier OR what is located at location
+ String relation = binaryTextRelation.getCategory(); // "degree_of", "location_of"
+
+ if (relation.equals("degree_of")) {
+
+ Modifier severity = (Modifier) arg2.getArgument();
+ // degree_of is aka severity, which applies to SignSymptomMention/SignSymptom and DiseaseDisorder
+ // find Mention associated with arg1
+ IdentifiedAnnotation arg1Arg = (IdentifiedAnnotation) arg1.getArgument();
+ // set severity within the Mention to be arg2 (the Modifier)
+ // Note at this point mapToMentions.get(entityMention) might be an entityMention instead of an EventMention
+ // for example rec041 in the seed set resulted in
+ // ClassCastException: org.apache.ctakes.typesystem.type.textsem.AnatomicalSiteMention
+ // cannot be cast to org.apache.ctakes.typesystem.type.textsem.EventMention
+ IdentifiedAnnotation ia = mapToMentions.get(arg1Arg);
+ if (ia instanceof EntityMention) {
+ EntityMention entityMention = (EntityMention) ia;
+ logger.error("Need to implement cases for handling EntityMention " + entityMention + " within relation: " + relation);
+ logger.error(" severity " + severity + " in relation " + relation + " with/to " + entityMention);
+ logger.error(" Using covered text: severity " + severity.getCoveredText() + " in relation " + relation + " with/to " + entityMention.getCoveredText());
+ } else {
+ EventMention eventMention = (EventMention) ia;
+ if (eventMention instanceof DiseaseDisorderMention) {
+ DiseaseDisorderMention ddm = (DiseaseDisorderMention) eventMention;
+ logger.error("Need to implement attr for " + relation + " for DiseaseDisorderMention");
+ } else if (eventMention instanceof SignSymptomMention) {
+ SignSymptomMention ssm = (SignSymptomMention) eventMention;
+ ssm.setSeverity(degreeOfTextRelation);
+ } else {
+ logger.error("Need to implement more cases for handling EventMention " + eventMention + " within relation: " + relation);
+ }
+ }
+
+ } else if (relation.equals("location_of")) {
+
+ EntityMention arg2Arg = (EntityMention) arg2.getArgument(); // wrongly created as EntityMention prior to 3.0
+ IdentifiedAnnotation ia = mapToMentions.get(arg2Arg);
+
+ if (ia instanceof EntityMention) {
+
+ // Note you apparently can have an AnatomicalSiteMention be the location_of an AnatomicalSiteMention
+ // from running rec041, end up with things like "Left lower extremity" location_of "common femoral vein"
+ // and "left renal vein" in relation location_of to anatomical site mention "renal vein"
+ // and "vein" in relation location_of to anatomical site mention "renal vein"
+ EntityMention entityMention = (EntityMention) ia;
+ IdentifiedAnnotation location = (IdentifiedAnnotation) arg1.getArgument();
+ IdentifiedAnnotation loc = (IdentifiedAnnotation)mapToMentions.get(location);
+ if (loc instanceof AnatomicalSiteMention) {
+ AnatomicalSiteMention asm = (AnatomicalSiteMention) loc;
+ //asm.setBodyLocation(binaryTextRelation); // uncomment iff AnatomicalSiteMention ends up with a bodyLocation attribute
+ } else {
+ logger.error("Need to implement cases for handling EntityMention " + entityMention + " within relation: " + relation);
+ logger.error(" loc " + loc + " in relation " + relation + " with/to " + entityMention);
+ logger.error(" Using covered text: loc " + loc.getCoveredText() + " in relation " + relation + " with/to " + entityMention.getCoveredText());
+ }
+
+ } else {
+
+ EventMention eventMention = (EventMention) ia;
+
+ if (eventMention instanceof DiseaseDisorderMention) { //(eventMention.getTypeID()==CONST.NE_TYPE_ID_DISORDER) {
+ DiseaseDisorderMention ddm = (DiseaseDisorderMention) eventMention;
+ ddm.setBodyLocation(locationOfTextRelation);
+ } else if (eventMention instanceof ProcedureMention) { //(eventMention.getTypeID()==CONST.NE_TYPE_ID_PROCEDURE) {
+ ProcedureMention pm = (ProcedureMention) eventMention;
+ pm.setBodyLocation(locationOfTextRelation);
+ } else if (eventMention instanceof SignSymptomMention) { //(eventMention.getTypeID()==CONST.NE_TYPE_ID_FINDING) {
+ SignSymptomMention ssm = (SignSymptomMention) eventMention;
+ ssm.setBodyLocation(locationOfTextRelation);
+ } else {
+ logger.error("Need to implement more cases for handling EventMention " + eventMention + " within relation: " + relation);
+ }
+
+ }
+ } else {
+ logger.error("Need to implement more cases for relation: " + relation);
+ }
+ }
+ }
+
+ logger.debug("Number of BinaryTextRelations = " + i);
+
+
+ }
+
+ private FSIterator<Annotation> getAllAnnotations(JCas jcas, int type) {
+ JFSIndexRepository indexes = jcas.getJFSIndexRepository();
+ FSIterator<Annotation> annotationsIter = indexes.getAnnotationIndex(type).iterator();
+ // while (segmentItr.hasNext()) {
+ // }
+ return annotationsIter;
+ }
+
+
+}
Propchange: ctakes/trunk/ctakes-template-filler/src/main/java/org/apache/ctakes/template/filler/ae/TemplateFillerAnnotator.java
------------------------------------------------------------------------------
svn:mime-type = text/plain