ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From james-mas...@apache.org
Subject svn commit: r1477693 - in /ctakes/trunk/ctakes-template-filler: ./ desc/analysis_engine/ src/main/java/org/apache/ctakes/templatefiller/ae/ src/main/test/ src/main/test/java/
Date Tue, 30 Apr 2013 15:38:52 GMT
Author: james-masanz
Date: Tue Apr 30 15:38:51 2013
New Revision: 1477693

URL: http://svn.apache.org/r1477693
Log:
create MedicationMention and fill in based on information from MedicationEventMention, if MedicationEventMention was created (which drug ner creates)

Added:
    ctakes/trunk/ctakes-template-filler/desc/analysis_engine/RelationExtractorAggregateWithoutOrangeBook.xml   (with props)
    ctakes/trunk/ctakes-template-filler/src/main/test/
    ctakes/trunk/ctakes-template-filler/src/main/test/java/
Modified:
    ctakes/trunk/ctakes-template-filler/desc/analysis_engine/AggregateTemplateFiller.xml
    ctakes/trunk/ctakes-template-filler/pom.xml
    ctakes/trunk/ctakes-template-filler/src/main/java/org/apache/ctakes/templatefiller/ae/TemplateFillerAnnotator.java

Modified: 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=1477693&r1=1477692&r2=1477693&view=diff
==============================================================================
--- ctakes/trunk/ctakes-template-filler/desc/analysis_engine/AggregateTemplateFiller.xml (original)
+++ ctakes/trunk/ctakes-template-filler/desc/analysis_engine/AggregateTemplateFiller.xml Tue Apr 30 15:38:51 2013
@@ -4,7 +4,7 @@
   <primitive>false</primitive>
   <delegateAnalysisEngineSpecifiers>
     <delegateAnalysisEngine key="RelationExtractorAnnotator">
-      <import location="../../../ctakes-relation-extractor/desc/analysis_engine/RelationExtractorAggregate_wo_OrangeBook.xml"/>
+      <import location="RelationExtractorAggregateWithoutOrangeBook.xml"/>
     </delegateAnalysisEngine>
     <delegateAnalysisEngine key="TemplateFillerAnnotator">
       <import location="../../../ctakes-template-filler/desc/analysis_engine/TemplateFillerAnnotator.xml"/>

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=1477693&view=auto
==============================================================================
--- ctakes/trunk/ctakes-template-filler/desc/analysis_engine/RelationExtractorAggregateWithoutOrangeBook.xml (added)
+++ ctakes/trunk/ctakes-template-filler/desc/analysis_engine/RelationExtractorAggregateWithoutOrangeBook.xml Tue Apr 30 15:38:51 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/ctakes-drug-ner/desc/analysis_engine/DrugMentionAnnotator.xml"/>
+    </delegateAnalysisEngine>
+    <delegateAnalysisEngine key="DrugLookupWindowAnnotator">
+      <import location="../../../ctakes/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/ctakes-drug-ner/desc/analysis_engine/DrugMentionAnnotator.xml"/>
+    </delegateAnalysisEngine>
+    <delegateAnalysisEngine key="DrugLookupWindowAnnotator">
+      <import location="../../../ctakes/ctakes-drug-ner/desc/analysis_engine/DrugLookupWindowAnnotator.xml"/>
+    </delegateAnalysisEngine>
+                    <delegateAnalysisEngine key="TokenizerAnnotator">
+                        <import location="../../../ctakes/ctakes-core/desc/analysis_engine/TokenizerAnnotator.xml"/>
+                    </delegateAnalysisEngine>
+                    <delegateAnalysisEngine key="ContextDependentTokenizerAnnotator">
+                        <import location="../../../ctakes/ctakes-context-tokenizer/desc/analysis_engine/ContextDependentTokenizerAnnotator.xml"/>
+                    </delegateAnalysisEngine>
+                    <delegateAnalysisEngine key="ConstituencyParser">
+                        <import location="../../../ctakes/ctakes-constituency-parser/desc/ConstituencyParserAnnotator.xml"/>
+                    </delegateAnalysisEngine>
+                    <delegateAnalysisEngine key="StatusAnnotator">
+                        <import location="../../../ctakes/ctakes-ne-contexts/desc/StatusAnnotator.xml"/>
+                    </delegateAnalysisEngine>
+                    <delegateAnalysisEngine key="NegationAnnotator">
+                        <import location="../../../ctakes/ctakes-ne-contexts/desc/NegationAnnotator.xml"/>
+                    </delegateAnalysisEngine>
+                    <delegateAnalysisEngine key="SentenceDetectorAnnotator">
+                        <import location="../../../ctakes/ctakes-core/desc/analysis_engine/SentenceDetectorAnnotator.xml"/>
+                    </delegateAnalysisEngine>
+                    <delegateAnalysisEngine key="AdjustNounPhraseToIncludeFollowingNP">
+                        <import location="../../../ctakes/ctakes-chunker/desc/AdjustNounPhraseToIncludeFollowingNP.xml"/>
+                    </delegateAnalysisEngine>
+                    <delegateAnalysisEngine key="AdjustNounPhraseToIncludeFollowingPPNP">
+                        <import location="../../../ctakes/ctakes-chunker/desc/AdjustNounPhraseToIncludeFollowingPPNP.xml"/>
+                    </delegateAnalysisEngine>
+                    <delegateAnalysisEngine key="SimpleSegmentAnnotator">
+                        <import location="../../../ctakes/ctakes-clinical-pipeline/desc/analysis_engine/SimpleSegmentAnnotator.xml"/>
+                    </delegateAnalysisEngine>
+                    <delegateAnalysisEngine key="POSTagger">
+                        <import location="../../../ctakes/ctakes-pos-tagger/desc/POSTagger.xml"/>
+                    </delegateAnalysisEngine>
+                    <delegateAnalysisEngine key="Chunker">
+                        <import location="../../../ctakes/ctakes-chunker/desc/Chunker.xml"/>
+                    </delegateAnalysisEngine>
+                    <delegateAnalysisEngine key="ClearNLPAE">
+                        <import location="../../../ctakes/ctakes-dependency-parser/desc/analysis_engine/ClearNLPDependencyParserAE.xml"/>
+                    </delegateAnalysisEngine>
+                    <delegateAnalysisEngine key="DictionaryLookupAnnotatorDB">
+                        <import location="../../../ctakes/ctakes-dictionary-lookup/desc/analysis_engine/DictionaryLookupAnnotatorUMLS.xml"/>
+                    </delegateAnalysisEngine>
+                    <delegateAnalysisEngine key="ExtractionPrepAnnotator">
+                        <import location="../../../ctakes/ctakes-clinical-pipeline/desc/analysis_engine/ExtractionPrepAnnotator.xml"/>
+                    </delegateAnalysisEngine>
+                    <delegateAnalysisEngine key="LookupWindowAnnotator">
+                        <import location="../../../ctakes/ctakes-clinical-pipeline/desc/analysis_engine/LookupWindowAnnotator.xml"/>
+                    </delegateAnalysisEngine>
+                    <delegateAnalysisEngine key="LvgAnnotator">
+                        <import location="../../../ctakes/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

Modified: ctakes/trunk/ctakes-template-filler/pom.xml
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-template-filler/pom.xml?rev=1477693&r1=1477692&r2=1477693&view=diff
==============================================================================
--- ctakes/trunk/ctakes-template-filler/pom.xml (original)
+++ ctakes/trunk/ctakes-template-filler/pom.xml Tue Apr 30 15:38:51 2013
@@ -39,6 +39,30 @@
 		</dependency>
 		<dependency>
 			<groupId>org.apache.ctakes</groupId>
+			<artifactId>ctakes-drug-ner</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.ctakes</groupId>
+			<artifactId>ctakes-drug-ner-res</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.ctakes</groupId>
+			<artifactId>ctakes-relation-extractor</artifactId>
+		</dependency>	    
+		<dependency>
+			<groupId>org.apache.ctakes</groupId>
+			<artifactId>ctakes-relation-extractor-res</artifactId>
+		</dependency>	    
+	<dependency>
+		<groupId>org.apache.ctakes</groupId>
+		<artifactId>ctakes-chunker</artifactId>
+	</dependency>
+	<dependency>
+		<groupId>org.apache.ctakes</groupId>
+		<artifactId>ctakes-dictionary-lookup</artifactId>
+	</dependency>
+		<dependency>
+			<groupId>org.apache.ctakes</groupId>
 			<artifactId>ctakes-utils</artifactId>
 		</dependency>
 		<dependency>

Modified: ctakes/trunk/ctakes-template-filler/src/main/java/org/apache/ctakes/templatefiller/ae/TemplateFillerAnnotator.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-template-filler/src/main/java/org/apache/ctakes/templatefiller/ae/TemplateFillerAnnotator.java?rev=1477693&r1=1477692&r2=1477693&view=diff
==============================================================================
--- ctakes/trunk/ctakes-template-filler/src/main/java/org/apache/ctakes/templatefiller/ae/TemplateFillerAnnotator.java (original)
+++ ctakes/trunk/ctakes-template-filler/src/main/java/org/apache/ctakes/templatefiller/ae/TemplateFillerAnnotator.java Tue Apr 30 15:38:51 2013
@@ -9,6 +9,7 @@ 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;
@@ -22,6 +23,14 @@ import org.apache.uima.jcas.tcas.Annotat
 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;
@@ -32,38 +41,48 @@ import org.apache.ctakes.typesystem.type
 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;
-    private boolean REMOVE_ORIGINAL_MENTIONS = false;
 
-    /**
-     * @param args
-     */
-    public static void main(String[] args) {
-	// For simple tests. 
-	// TODO Move to junit or other test classes later.
-
-    }
 
     @Override
     public void initialize(UimaContext aContext) throws ResourceInitializationException {
 
-	super.initialize(aContext);
-	uimaContext = aContext;
+    	super.initialize(aContext);
+    	uimaContext = aContext;
 
-	logger.info("Initializing " +  TemplateFillerAnnotator.class.getName());
+    	logger.info("Initializing " +  TemplateFillerAnnotator.class.getName());
 	
     }
 
-    private void setAttributesFromOriginal(IdentifiedAnnotation mention, IdentifiedAnnotation original) {
-	mention.setBegin(original.getBegin());
+    /**
+     * Copy values from <code>original</code> to <code>mention</code> and add <code>mention</code> to the indexes.
+     * If <code>original</code> is a MedicationEventMention (which are 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());
@@ -76,13 +95,88 @@ public class TemplateFillerAnnotator ext
     	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.info("process(JCas) in " + TemplateFillerAnnotator.class.getName());
+	logger.debug("process(JCas) in " + TemplateFillerAnnotator.class.getName());
 	
 	// Get all IdentifiedAnnotations
 	FSIterator<Annotation> identifiedAnnotationsIter = getAllAnnotations(jcas, IdentifiedAnnotation.type);
@@ -91,11 +185,36 @@ public class TemplateFillerAnnotator ext
 
 	// 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;
-	    switch (original.getTypeID()) {
-	    
+	    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 creates MedicationEventMentions still.
+	    	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) is creating MedicationEventMention, create MedicationMention instead with its attributes
+	    		// based on 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
@@ -104,7 +223,7 @@ public class TemplateFillerAnnotator ext
 	    	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
@@ -113,19 +232,17 @@ public class TemplateFillerAnnotator ext
 	    	setAttributesFromOriginal(mention, original);
 	    	annotationsToRemoveFromCas.add(original);
 	    	break;
-    		
+
 	    	case CONST.NE_TYPE_ID_DRUG: ;
-	    	// TODO use org.apache.ctakes.typesystem.type.textsem.MedicationMention
-	    	//org.apache.ctakes.typesystem.type.textsem.MedicationEventMention
-	    	//org.apache.ctakes.typesystem.type.textsem.EventMention
 
-	    	// TODO is this needed or are we already creating MedicationEventMentions
-	    	//mention = new MedicationEventMention(jcas);
-	    	//mapToMentions.put(original, mention);
-	    	//setAttributesFromOriginal(mention, original);
-	    	//annotationsToRemoveFromCas.add(original);
+    		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
@@ -134,7 +251,7 @@ public class TemplateFillerAnnotator ext
 	    	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
@@ -143,123 +260,122 @@ public class TemplateFillerAnnotator ext
 	    	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. 
 	
-	// Fill in template slots from relations etc
-	logger.info("TODO finish writing code to fill in template slots");
-	
-	FSIndex<FeatureStructure> relationArgs = jcas.getFSIndexRepository().getIndex("_org.apache.ctakes.typesystem.type.relation.RelationArgument_GeneratedIndex"); // TODO do we need this?
+	//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) {
-                        //	if (ia instanceof AnatomicalSiteMention) {
-                        //	    AnatomicalSiteMention asm = (AnatomicalSiteMention) ia;
-                        //	    asm.setSeverity(severity);
-                        //	} 
-			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"); // TODO 
-			} 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.getTypeID()==CONST.NE_TYPE_ID_DISORDER) { // TODO in 3.0 consider using arg2 instanceof DiseaseDisorderMention?
-			    DiseaseDisorderMention ddm = (DiseaseDisorderMention) eventMention;
-			    
-			    ddm.setBodyLocation(locationOfTextRelation);
-			} else if (eventMention.getTypeID()==CONST.NE_TYPE_ID_PROCEDURE) { // TODO in 3.0 consider using arg2 instanceof ProcedureMention?
-			    ProcedureMention pm = (ProcedureMention) eventMention;
-			    pm.setBodyLocation(locationOfTextRelation);
-			} else if (eventMention.getTypeID()==CONST.NE_TYPE_ID_FINDING) { // TODO in 3.0 consider using arg2 instanceof SignSymptomMention?
-			    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.info("Number of BinaryTextRelations = " + i);
-	 
 	
-	if (REMOVE_ORIGINAL_MENTIONS) {
-	    // Remove the annotations we no longer need
-	    for (Annotation anno: annotationsToRemoveFromCas) {
-		jcas.removeFsFromIndexes(anno);
+	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);
+	 
 	
     }
 



Mime
View raw message