ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seanfi...@apache.org
Subject svn commit: r1814586 - in /ctakes/trunk: ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/pipeline/ ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/
Date Wed, 08 Nov 2017 14:52:07 GMT
Author: seanfinan
Date: Wed Nov  8 14:52:06 2017
New Revision: 1814586

URL: http://svn.apache.org/viewvc?rev=1814586&view=rev
Log:
Add logging to common temporal engines

Modified:
    ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/pipeline/TemporalSubPipe.piper
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/BackwardsTimeAnnotator.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/DocTimeRelAnnotator.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/EventAnnotator.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/EventEventRelationAnnotator.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/EventTimeRelationAnnotator.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/TemporalRelationExtractorAnnotator.java

Modified: ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/pipeline/TemporalSubPipe.piper
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/pipeline/TemporalSubPipe.piper?rev=1814586&r1=1814585&r2=1814586&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/pipeline/TemporalSubPipe.piper
(original)
+++ ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/pipeline/TemporalSubPipe.piper
Wed Nov  8 14:52:06 2017
@@ -4,16 +4,16 @@
 addDescription EventAnnotator
 
 // Times.  Use addLogged to log start and finish of processing.  There aren't default models,
so set specifically
-addLogged BackwardsTimeAnnotator classifierJarPath=/org/apache/ctakes/temporal/ae/timeannotator/model.jar
+add BackwardsTimeAnnotator classifierJarPath=/org/apache/ctakes/temporal/ae/timeannotator/model.jar
 
 // DocTimeRel: the relation bin for Events to the Document Creation Time.
-addLogged DocTimeRelAnnotator classifierJarPath=/org/apache/ctakes/temporal/ae/doctimerel/model.jar
+add DocTimeRelAnnotator classifierJarPath=/org/apache/ctakes/temporal/ae/doctimerel/model.jar
 
 // Event - Time binary relations.
-addLogged EventTimeRelationAnnotator classifierJarPath=/org/apache/ctakes/temporal/ae/eventtime/model.jar
+add EventTimeRelationAnnotator classifierJarPath=/org/apache/ctakes/temporal/ae/eventtime/model.jar
 
 // Event - Event binary relations.
-addLogged EventEventRelationAnnotator classifierJarPath=/org/apache/ctakes/temporal/ae/eventevent/model.jar
+add EventEventRelationAnnotator classifierJarPath=/org/apache/ctakes/temporal/ae/eventevent/model.jar
 
 //  Need to improve.  Generic Events (head words) should be replaced by overlapping subclasses
with relations adjusted.
 //add FullTemporalExtractionPipeline.CopyPropertiesToTemporalEventAnnotator

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/BackwardsTimeAnnotator.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/BackwardsTimeAnnotator.java?rev=1814586&r1=1814585&r2=1814586&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/BackwardsTimeAnnotator.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/BackwardsTimeAnnotator.java
Wed Nov  8 14:52:06 2017
@@ -20,12 +20,14 @@ package org.apache.ctakes.temporal.ae;
 
 import com.google.common.collect.Lists;
 import org.apache.ctakes.core.pipeline.PipeBitInfo;
+import org.apache.ctakes.core.util.DotLogger;
 import org.apache.ctakes.temporal.ae.feature.ParseSpanFeatureExtractor;
 import org.apache.ctakes.temporal.ae.feature.TimeWordTypeExtractor;
 import org.apache.ctakes.typesystem.type.syntax.BaseToken;
 import org.apache.ctakes.typesystem.type.textsem.TimeMention;
 import org.apache.ctakes.typesystem.type.textspan.Segment;
 import org.apache.ctakes.typesystem.type.textspan.Sentence;
+import org.apache.log4j.Logger;
 import org.apache.uima.UimaContext;
 import org.apache.uima.analysis_engine.AnalysisEngineDescription;
 import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
@@ -51,6 +53,7 @@ import org.cleartk.ml.jar.DirectoryDataW
 import org.cleartk.ml.jar.GenericJarClassifierFactory;
 
 import java.io.File;
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -65,6 +68,8 @@ import java.util.List;
 )
 public class BackwardsTimeAnnotator extends TemporalEntityAnnotator_ImplBase {
 
+   static private final Logger LOGGER = Logger.getLogger( "BackwardsTimeAnnotator" );
+
   public static final String PARAM_TIMEX_VIEW = "TimexView";
   @ConfigurationParameter(
       name = PARAM_TIMEX_VIEW,
@@ -149,33 +154,39 @@ public class BackwardsTimeAnnotator exte
 
   @Override
   public void initialize(UimaContext context) throws ResourceInitializationException {
-    super.initialize(context);
-
-    // define chunking
-    this.timeChunking = new BioChunking<BaseToken, TimeMention>(BaseToken.class, TimeMention.class,
"timeClass");
-
-    CombinedExtractor1<BaseToken> allExtractors = new CombinedExtractor1<>(
-        new CoveredTextExtractor<BaseToken>(),
-        CharacterCategoryPatternFunction.<BaseToken>createExtractor(PatternType.REPEATS_MERGED),
-        CharacterCategoryPatternFunction.<BaseToken>createExtractor(PatternType.ONE_PER_CHAR),
-        new TypePathExtractor<>(BaseToken.class, "partOfSpeech"),
-        new TimeWordTypeExtractor<BaseToken>());
+     LOGGER.info( "Initializing ..." );
+     try ( DotLogger dotter = new DotLogger() ) {
+        super.initialize( context );
+
+        // define chunking
+        this.timeChunking = new BioChunking<BaseToken, TimeMention>(BaseToken.class,
TimeMention.class, "timeClass");
+
+        CombinedExtractor1<BaseToken> allExtractors = new CombinedExtractor1<>(
+              new CoveredTextExtractor<BaseToken>(),
+              CharacterCategoryPatternFunction.<BaseToken>createExtractor(PatternType.REPEATS_MERGED),
+              CharacterCategoryPatternFunction.<BaseToken>createExtractor(PatternType.ONE_PER_CHAR),
+              new TypePathExtractor<>(BaseToken.class, "partOfSpeech"),
+              new TimeWordTypeExtractor<BaseToken>());
 
 //    CombinedExtractor1 parseExtractors = new CombinedExtractor(
 //        new ParseSpanFeatureExtractor()
 //        );
-    this.tokenFeatureExtractors = new ArrayList<FeatureExtractor1>();
-    this.tokenFeatureExtractors.add(allExtractors);
+        this.tokenFeatureExtractors = new ArrayList<FeatureExtractor1>();
+        this.tokenFeatureExtractors.add(allExtractors);
 
-    this.contextFeatureExtractors = new ArrayList<CleartkExtractor>();
-    this.contextFeatureExtractors.add(new CleartkExtractor(
-        BaseToken.class,
-        allExtractors,
-        new Preceding(3),
-        new Following(3)));
+        this.contextFeatureExtractors = new ArrayList<CleartkExtractor>();
+        this.contextFeatureExtractors.add(new CleartkExtractor(
+              BaseToken.class,
+              allExtractors,
+              new Preceding(3),
+              new Following(3)));
 //    this.parseFeatureExtractors = new ArrayList<ParseSpanFeatureExtractor>();
 //    this.parseFeatureExtractors.add(new ParseSpanFeatureExtractor());
-    parseExtractor = new ParseSpanFeatureExtractor();
+        parseExtractor = new ParseSpanFeatureExtractor();
+     } catch ( IOException ioE ) {
+        throw new ResourceInitializationException( ioE );
+     }
+     LOGGER.info( "Finished." );
   }
 
   @Override

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/DocTimeRelAnnotator.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/DocTimeRelAnnotator.java?rev=1814586&r1=1814585&r2=1814586&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/DocTimeRelAnnotator.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/DocTimeRelAnnotator.java
Wed Nov  8 14:52:06 2017
@@ -18,32 +18,16 @@
  */
 package org.apache.ctakes.temporal.ae;
 
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-//import java.io.IOException;
-import java.util.List;
-//import java.util.Map;
-import java.util.Map;
-
 import org.apache.ctakes.core.pipeline.PipeBitInfo;
-import org.apache.ctakes.temporal.ae.feature.ClosestVerbExtractor;
-import org.apache.ctakes.temporal.ae.feature.ContinuousTextExtractor;
-import org.apache.ctakes.temporal.ae.feature.CoveredTextToValuesExtractor;
-import org.apache.ctakes.temporal.ae.feature.DateAndMeasurementExtractor;
-import org.apache.ctakes.temporal.ae.feature.EventPropertyExtractor;
-import org.apache.ctakes.temporal.ae.feature.NearbyVerbTenseXExtractor;
-import org.apache.ctakes.temporal.ae.feature.SectionHeaderExtractor;
-import org.apache.ctakes.temporal.ae.feature.TimeXExtractor;
-import org.apache.ctakes.temporal.ae.feature.UmlsSingleFeatureExtractor;
-import org.apache.ctakes.temporal.ae.feature.duration.DurationExpectationFeatureExtractor;
+import org.apache.ctakes.core.util.DotLogger;
+import org.apache.ctakes.temporal.ae.feature.*;
 import org.apache.ctakes.temporal.utils.SoftMaxUtil;
 import org.apache.ctakes.typesystem.type.refsem.Event;
 import org.apache.ctakes.typesystem.type.refsem.EventProperties;
-//import org.apache.ctakes.temporal.ae.feature.duration.DurationExpectationFeatureExtractor;
 import org.apache.ctakes.typesystem.type.syntax.BaseToken;
 import org.apache.ctakes.typesystem.type.textsem.EventMention;
 import org.apache.ctakes.typesystem.type.textspan.Sentence;
+import org.apache.log4j.Logger;
 import org.apache.uima.UimaContext;
 import org.apache.uima.analysis_engine.AnalysisEngineDescription;
 import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
@@ -57,24 +41,23 @@ import org.cleartk.ml.CleartkAnnotator;
 import org.cleartk.ml.DataWriter;
 import org.cleartk.ml.Feature;
 import org.cleartk.ml.Instance;
-import org.cleartk.ml.feature.extractor.CleartkExtractor;
-import org.cleartk.ml.feature.extractor.CleartkExtractor.Bag;
-import org.cleartk.ml.feature.extractor.CleartkExtractor.Covered;
-import org.cleartk.ml.feature.extractor.CleartkExtractor.FirstCovered;
-import org.cleartk.ml.feature.extractor.CleartkExtractor.Following;
-import org.cleartk.ml.feature.extractor.CleartkExtractor.LastCovered;
-import org.cleartk.ml.feature.extractor.CleartkExtractor.Preceding;
+import org.cleartk.ml.feature.extractor.*;
+import org.cleartk.ml.feature.extractor.CleartkExtractor.*;
 import org.cleartk.ml.feature.function.CharacterCategoryPatternFunction;
 import org.cleartk.ml.feature.function.CharacterCategoryPatternFunction.PatternType;
-import org.cleartk.ml.feature.extractor.CleartkExtractorException;
-import org.cleartk.ml.feature.extractor.CombinedExtractor1;
-import org.cleartk.ml.feature.extractor.CoveredTextExtractor;
-import org.cleartk.ml.feature.extractor.TypePathExtractor;
 import org.cleartk.ml.jar.DefaultDataWriterFactory;
 import org.cleartk.ml.jar.DirectoryDataWriterFactory;
 import org.cleartk.ml.jar.GenericJarClassifierFactory;
 
-import com.google.common.base.Charsets;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+//import java.io.IOException;
+//import java.util.Map;
+//import org.apache.ctakes.temporal.ae.feature.duration.DurationExpectationFeatureExtractor;
 
 //import com.google.common.base.Charsets;
 
@@ -86,6 +69,8 @@ import com.google.common.base.Charsets;
 )
 public class DocTimeRelAnnotator extends CleartkAnnotator<String> {
 
+   static private final Logger LOGGER = Logger.getLogger( "DocTimeRelAnnotator" );
+
 	public static AnalysisEngineDescription createDataWriterDescription(
 			Class<? extends DataWriter<String>> dataWriterClass,
 					File outputDirectory) throws ResourceInitializationException {
@@ -147,55 +132,61 @@ public class DocTimeRelAnnotator extends
 
 	@Override
 	public void initialize(UimaContext context) throws ResourceInitializationException {
-		super.initialize(context);
-		CombinedExtractor1<BaseToken> baseExtractor = new CombinedExtractor1<>(
-				new CoveredTextExtractor<BaseToken>(),
-				CharacterCategoryPatternFunction.<BaseToken>createExtractor(PatternType.ONE_PER_CHAR),
-				new TypePathExtractor<>(BaseToken.class, "partOfSpeech"));
-		this.contextExtractor = new CleartkExtractor<>(
-				BaseToken.class,
-				baseExtractor,
-				new Preceding(3),
-				new FirstCovered(1),
-				new LastCovered(1),
-				new Bag(new Covered()),
-				new Following(3));
-		final String vectorFile = "org/apache/ctakes/temporal/mimic_vectors.txt";
-		final String vectorFile2 = "org/apache/ctakes/temporal/thyme_word2vec_mapped_50.vec";
-		try {
-			this.continuousText = new ContinuousTextExtractor(vectorFile);
-			this.continuousText2 = new ContinuousTextExtractor(vectorFile2);
-		} catch (CleartkExtractorException e) {
-			System.err.println("cannot find file: "+ vectorFile);
-			e.printStackTrace();
-		}
-		this.tokenVectorContext = new CleartkExtractor<>(
-				BaseToken.class,
-				continuousText,      
-				new Preceding(5),
-				new Covered(),
-				new Following(5));
-		this.tokenVectorContext2 = new CleartkExtractor<>(
-				BaseToken.class,
-				continuousText2,  
-				new Covered());
-		this.sectionIDExtractor = new SectionHeaderExtractor();
-		this.closestVerbExtractor = new ClosestVerbExtractor();
-		this.timeXExtractor = new TimeXExtractor();
-		this.genericExtractor = new EventPropertyExtractor();
-//		this.umlsExtractor = new UmlsSingleFeatureExtractor();
-		this.verbTensePatternExtractor = new NearbyVerbTenseXExtractor();
-
-		this.dateExtractor = new DateAndMeasurementExtractor();
-		
-//		try {
-//			Map<String, double[]> word_disSem = CoveredTextToValuesExtractor.parseTextDoublesMap(new
File("src/main/resources/embeddings.size25.txt"), Charsets.UTF_8);
-//			this.disSemExtractor = new CoveredTextToValuesExtractor("DisSemFeat", word_disSem);
-//		} catch (IOException e) {
-//			e.printStackTrace();
-//		}
-//		this.durationExtractor = new DurationExpectationFeatureExtractor();
-	}
+      LOGGER.info( "Initializing ..." );
+      try ( DotLogger dotter = new DotLogger() ) {
+         super.initialize( context );
+         CombinedExtractor1<BaseToken> baseExtractor = new CombinedExtractor1<>(
+               new CoveredTextExtractor<BaseToken>(),
+               CharacterCategoryPatternFunction.<BaseToken>createExtractor( PatternType.ONE_PER_CHAR
),
+               new TypePathExtractor<>( BaseToken.class, "partOfSpeech" ) );
+         this.contextExtractor = new CleartkExtractor<>(
+               BaseToken.class,
+               baseExtractor,
+               new Preceding( 3 ),
+               new FirstCovered( 1 ),
+               new LastCovered( 1 ),
+               new Bag( new Covered() ),
+               new Following( 3 ) );
+         final String vectorFile = "org/apache/ctakes/temporal/mimic_vectors.txt";
+         final String vectorFile2 = "org/apache/ctakes/temporal/thyme_word2vec_mapped_50.vec";
+         try {
+            this.continuousText = new ContinuousTextExtractor( vectorFile );
+            this.continuousText2 = new ContinuousTextExtractor( vectorFile2 );
+         } catch ( CleartkExtractorException e ) {
+            System.err.println( "cannot find file: " + vectorFile );
+            e.printStackTrace();
+         }
+         this.tokenVectorContext = new CleartkExtractor<>(
+               BaseToken.class,
+               continuousText,
+               new Preceding( 5 ),
+               new Covered(),
+               new Following( 5 ) );
+         this.tokenVectorContext2 = new CleartkExtractor<>(
+               BaseToken.class,
+               continuousText2,
+               new Covered() );
+         this.sectionIDExtractor = new SectionHeaderExtractor();
+         this.closestVerbExtractor = new ClosestVerbExtractor();
+         this.timeXExtractor = new TimeXExtractor();
+         this.genericExtractor = new EventPropertyExtractor();
+         //		this.umlsExtractor = new UmlsSingleFeatureExtractor();
+         this.verbTensePatternExtractor = new NearbyVerbTenseXExtractor();
+
+         this.dateExtractor = new DateAndMeasurementExtractor();
+
+         //		try {
+         //			Map<String, double[]> word_disSem = CoveredTextToValuesExtractor.parseTextDoublesMap(new
File("src/main/resources/embeddings.size25.txt"), Charsets.UTF_8);
+         //			this.disSemExtractor = new CoveredTextToValuesExtractor("DisSemFeat", word_disSem);
+         //		} catch (IOException e) {
+         //			e.printStackTrace();
+         //		}
+         //		this.durationExtractor = new DurationExpectationFeatureExtractor();
+      } catch ( IOException ioE ) {
+         throw new ResourceInitializationException( ioE );
+      }
+      LOGGER.info( "Finished." );
+   }
 
 	@Override
 	public void process(JCas jCas) throws AnalysisEngineProcessException {

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/EventAnnotator.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/EventAnnotator.java?rev=1814586&r1=1814585&r2=1814586&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/EventAnnotator.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/EventAnnotator.java
Wed Nov  8 14:52:06 2017
@@ -19,14 +19,11 @@ package org.apache.ctakes.temporal.ae;
  * under the License.
  */
 
-import java.io.File;
-import java.io.IOException;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Random;
-
+import com.google.common.base.Predicate;
+import com.google.common.collect.HashMultimap;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Multimap;
 import org.apache.ctakes.core.pipeline.PipeBitInfo;
 import org.apache.ctakes.temporal.ae.feature.ChunkingExtractor;
 import org.apache.ctakes.temporal.ae.feature.PredicateArgumentExtractor;
@@ -54,24 +51,22 @@ import org.cleartk.ml.CleartkAnnotator;
 import org.cleartk.ml.Feature;
 import org.cleartk.ml.Instance;
 import org.cleartk.ml.chunking.BioChunking;
-import org.cleartk.ml.feature.extractor.CleartkExtractor;
+import org.cleartk.ml.feature.extractor.*;
 import org.cleartk.ml.feature.extractor.CleartkExtractor.Following;
 import org.cleartk.ml.feature.extractor.CleartkExtractor.Preceding;
-import org.cleartk.ml.feature.extractor.CombinedExtractor1;
-import org.cleartk.ml.feature.extractor.CoveredTextExtractor;
-import org.cleartk.ml.feature.extractor.FeatureExtractor1;
-import org.cleartk.ml.feature.extractor.TypePathExtractor;
 import org.cleartk.ml.feature.function.CharacterCategoryPatternFunction;
 import org.cleartk.ml.feature.function.CharacterCategoryPatternFunction.PatternType;
 import org.cleartk.ml.jar.DefaultDataWriterFactory;
 import org.cleartk.ml.jar.DirectoryDataWriterFactory;
 import org.cleartk.ml.jar.GenericJarClassifierFactory;
 
-import com.google.common.base.Predicate;
-import com.google.common.collect.HashMultimap;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Multimap;
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
 
 @PipeBitInfo(
       name = "Event Annotator",
@@ -246,10 +241,9 @@ public class EventAnnotator extends Temp
         	BaseToken lastToken = tokens.get(tokens.size() - 1);
             String value = String.format("%s_%s", entity.getClass().getSimpleName(), entity.getTypeID());
             endOfEntityFeatures.put(lastToken, new Feature("EndOf", value));
-        }       
+        }
       }
     }
-
     Random rand = new Random();
     
     //TRY SMOTE algorithm here to generate more minority class samples

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/EventEventRelationAnnotator.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/EventEventRelationAnnotator.java?rev=1814586&r1=1814585&r2=1814586&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/EventEventRelationAnnotator.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/EventEventRelationAnnotator.java
Wed Nov  8 14:52:06 2017
@@ -18,59 +18,24 @@
  */
 package org.apache.ctakes.temporal.ae;
 
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
+import com.google.common.collect.Lists;
 import org.apache.ctakes.core.pipeline.PipeBitInfo;
+import org.apache.ctakes.core.util.DotLogger;
 import org.apache.ctakes.relationextractor.ae.RelationExtractorAnnotator;
 import org.apache.ctakes.relationextractor.ae.features.PartOfSpeechFeaturesExtractor;
 import org.apache.ctakes.relationextractor.ae.features.RelationFeaturesExtractor;
-import org.apache.ctakes.relationextractor.ae.features.TokenFeaturesExtractor;
-import org.apache.ctakes.temporal.ae.feature.CheckSpecialWordRelationExtractor;
-import org.apache.ctakes.temporal.ae.feature.ConjunctionRelationFeaturesExtractor;
-//import org.apache.ctakes.temporal.ae.feature.DependencyParseUtils;
-import org.apache.ctakes.temporal.ae.feature.DependencyPathFeaturesExtractor;
-import org.apache.ctakes.temporal.ae.feature.CoordinateFeaturesExtractor;
-import org.apache.ctakes.temporal.ae.feature.DependingVerbsFeatureExtractor;
-import org.apache.ctakes.temporal.ae.feature.EmptyFeaturesExtractor;
-import org.apache.ctakes.temporal.ae.feature.MultiTokenFeaturesExtractor;
-//import org.apache.ctakes.temporal.ae.feature.EventInBetweenPropertyExtractor;
-//import org.apache.ctakes.temporal.ae.feature.EventOutsidePropertyExtractor;
-import org.apache.ctakes.temporal.ae.feature.SpecialAnnotationRelationExtractor;
-import org.apache.ctakes.temporal.ae.feature.TemporalPETFlatExtractor;
-import org.apache.ctakes.temporal.ae.feature.TokenPropertyFeaturesExtractor;
-import org.apache.ctakes.temporal.ae.feature.DeterminerRelationFeaturesExtractor;
-import org.apache.ctakes.temporal.ae.feature.RelationEmbeddingFeatureExtractor;
-import org.apache.ctakes.temporal.ae.feature.RelationSyntacticETEmbeddingFeatureExtractor;
-import org.apache.ctakes.temporal.ae.feature.RelationSyntacticEmbeddingFeatureExtractor;
-import org.apache.ctakes.temporal.ae.feature.EventArgumentPropertyExtractor;
-import org.apache.ctakes.temporal.ae.feature.EventTimeRelationFeatureExtractor;
-import org.apache.ctakes.temporal.ae.feature.EventPositionRelationFeaturesExtractor;
-import org.apache.ctakes.temporal.ae.feature.NumberOfEventsInTheSameSentenceExtractor;
-import org.apache.ctakes.temporal.ae.feature.NearbyVerbTenseRelationExtractor;
-import org.apache.ctakes.temporal.ae.feature.NumberOfEventTimeBetweenCandidatesExtractor;
-import org.apache.ctakes.temporal.ae.feature.OverlappedHeadFeaturesExtractor;
-import org.apache.ctakes.temporal.ae.feature.SRLRelationFeaturesExtractor;
-import org.apache.ctakes.temporal.ae.feature.TimeXRelationFeaturesExtractor;
-import org.apache.ctakes.temporal.ae.feature.SectionHeaderRelationExtractor;
-//import org.apache.ctakes.temporal.ae.feature.TemporalAttributeFeatureExtractor;
-import org.apache.ctakes.temporal.ae.feature.UmlsFeatureExtractor;
-import org.apache.ctakes.temporal.ae.feature.UnexpandedTokenFeaturesExtractor;
-//import org.apache.ctakes.temporal.ae.feature.UnexpandedTokenFeaturesExtractor;
-//import org.apache.ctakes.temporal.ae.feature.treekernel.TemporalPETExtractor;
+import org.apache.ctakes.temporal.ae.feature.*;
 import org.apache.ctakes.typesystem.type.relation.BinaryTextRelation;
 import org.apache.ctakes.typesystem.type.relation.RelationArgument;
 import org.apache.ctakes.typesystem.type.relation.TemporalTextRelation;
-//import org.apache.ctakes.typesystem.type.syntax.ConllDependencyNode;
 import org.apache.ctakes.typesystem.type.textsem.EventMention;
 import org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation;
 import org.apache.ctakes.typesystem.type.textspan.Sentence;
+import org.apache.log4j.Logger;
+import org.apache.uima.UimaContext;
 import org.apache.uima.analysis_engine.AnalysisEngineDescription;
+import org.apache.uima.fit.factory.AnalysisEngineFactory;
+import org.apache.uima.fit.util.JCasUtil;
 import org.apache.uima.jcas.JCas;
 import org.apache.uima.jcas.tcas.Annotation;
 import org.apache.uima.resource.ResourceInitializationException;
@@ -80,11 +45,21 @@ import org.cleartk.ml.feature.extractor.
 import org.cleartk.ml.jar.DefaultDataWriterFactory;
 import org.cleartk.ml.jar.DirectoryDataWriterFactory;
 import org.cleartk.ml.jar.GenericJarClassifierFactory;
-import org.cleartk.util.ViewUriUtil;
-import org.apache.uima.fit.factory.AnalysisEngineFactory;
-import org.apache.uima.fit.util.JCasUtil;
 
-import com.google.common.collect.Lists;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+//import org.apache.ctakes.temporal.ae.feature.DependencyParseUtils;
+//import org.apache.ctakes.temporal.ae.feature.EventInBetweenPropertyExtractor;
+//import org.apache.ctakes.temporal.ae.feature.EventOutsidePropertyExtractor;
+//import org.apache.ctakes.temporal.ae.feature.TemporalAttributeFeatureExtractor;
+//import org.apache.ctakes.temporal.ae.feature.UnexpandedTokenFeaturesExtractor;
+//import org.apache.ctakes.temporal.ae.feature.treekernel.TemporalPETExtractor;
+//import org.apache.ctakes.typesystem.type.syntax.ConllDependencyNode;
 
 @PipeBitInfo(
 		name = "E-E TLinker",
@@ -95,6 +70,8 @@ import com.google.common.collect.Lists;
 )
 public class EventEventRelationAnnotator extends TemporalRelationExtractorAnnotator {
 
+   static private final Logger LOGGER = Logger.getLogger( "EventEventRelationAnnotator" );
+
 	public static AnalysisEngineDescription createDataWriterDescription(
 			Class<? extends DataWriter<String>> dataWriterClass,
 					File outputDirectory,
@@ -140,6 +117,17 @@ public class EventEventRelationAnnotator
 	
 	private RelationSyntacticETEmbeddingFeatureExtractor embedingExtractor;
 
+   @Override
+   public void initialize( final UimaContext context ) throws ResourceInitializationException
{
+      LOGGER.info( "Initializing ..." );
+      try ( DotLogger dotter = new DotLogger() ) {
+         super.initialize( context );
+      } catch ( IOException ioE ) {
+         throw new ResourceInitializationException( ioE );
+      }
+      LOGGER.info( "Finished." );
+   }
+
 	@Override
 	protected List<RelationFeaturesExtractor<IdentifiedAnnotation,IdentifiedAnnotation>>
getFeatureExtractors() {
 		final String vectorFile = "org/apache/ctakes/temporal/gloveresult_3";

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/EventTimeRelationAnnotator.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/EventTimeRelationAnnotator.java?rev=1814586&r1=1814585&r2=1814586&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/EventTimeRelationAnnotator.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/EventTimeRelationAnnotator.java
Wed Nov  8 14:52:06 2017
@@ -18,41 +18,14 @@
  */
 package org.apache.ctakes.temporal.ae;
 
-import java.io.File;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-
+import com.google.common.collect.Lists;
 import org.apache.ctakes.core.pipeline.PipeBitInfo;
+import org.apache.ctakes.core.util.DotLogger;
 import org.apache.ctakes.relationextractor.ae.RelationExtractorAnnotator;
 import org.apache.ctakes.relationextractor.ae.features.PartOfSpeechFeaturesExtractor;
 import org.apache.ctakes.relationextractor.ae.features.RelationFeaturesExtractor;
 import org.apache.ctakes.relationextractor.ae.features.TokenFeaturesExtractor;
-import org.apache.ctakes.temporal.ae.feature.CheckSpecialWordRelationExtractor;
-import org.apache.ctakes.temporal.ae.feature.ConjunctionRelationFeaturesExtractor;
-import org.apache.ctakes.temporal.ae.feature.DependencyFeatureExtractor;
-import org.apache.ctakes.temporal.ae.feature.DependencyPathFeaturesExtractor;
-import org.apache.ctakes.temporal.ae.feature.EventArgumentPropertyExtractor;
-//import org.apache.ctakes.temporal.ae.feature.EventIndexOfSameSentenceRelationFeaturesExtractor;
-//import org.apache.ctakes.temporal.ae.feature.EventPositionRelationFeaturesExtractor;
-//import org.apache.ctakes.temporal.ae.feature.EventTimeRelationFeatureExtractor;
-import org.apache.ctakes.temporal.ae.feature.NearbyVerbTenseRelationExtractor;
-import org.apache.ctakes.temporal.ae.feature.NearestFlagFeatureExtractor;
-import org.apache.ctakes.temporal.ae.feature.NumberOfEventTimeBetweenCandidatesExtractor;
-import org.apache.ctakes.temporal.ae.feature.OverlappedHeadFeaturesExtractor;
-//import org.apache.ctakes.temporal.ae.feature.SRLRelationFeaturesExtractor;
-//import org.apache.ctakes.temporal.ae.feature.SectionHeaderRelationExtractor;
-import org.apache.ctakes.temporal.ae.feature.TemporalAttributeFeatureExtractor;
-import org.apache.ctakes.temporal.ae.feature.TemporalPETFlatExtractor;
-//import org.apache.ctakes.temporal.ae.feature.TimeWordTypeRelationExtractor;
-import org.apache.ctakes.temporal.ae.feature.TimeXPropertyRelationFeaturesExtractor;
-import org.apache.ctakes.temporal.ae.feature.TimeXRelationFeaturesExtractor;
-//import org.apache.ctakes.temporal.ae.feature.UnexpandedTokenFeaturesExtractor;
-//import org.apache.ctakes.temporal.ae.feature.TemporalAttributeFeatureExtractor;
-//import org.apache.ctakes.temporal.ae.feature.treekernel.EventTimeFlatTreeFeatureExtractor;
-//import org.apache.ctakes.temporal.ae.feature.treekernel.EventVerbRelationTreeExtractor;
-//import org.apache.ctakes.temporal.ae.feature.treekernel.TemporalPETExtractor;
-//import org.apache.ctakes.temporal.ae.feature.treekernel.TemporalPathExtractor;
+import org.apache.ctakes.temporal.ae.feature.*;
 import org.apache.ctakes.typesystem.type.relation.BinaryTextRelation;
 import org.apache.ctakes.typesystem.type.relation.RelationArgument;
 import org.apache.ctakes.typesystem.type.relation.TemporalTextRelation;
@@ -60,7 +33,11 @@ import org.apache.ctakes.typesystem.type
 import org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation;
 import org.apache.ctakes.typesystem.type.textsem.TimeMention;
 import org.apache.ctakes.typesystem.type.textspan.Sentence;
+import org.apache.log4j.Logger;
+import org.apache.uima.UimaContext;
 import org.apache.uima.analysis_engine.AnalysisEngineDescription;
+import org.apache.uima.fit.factory.AnalysisEngineFactory;
+import org.apache.uima.fit.util.JCasUtil;
 import org.apache.uima.jcas.JCas;
 import org.apache.uima.jcas.tcas.Annotation;
 import org.apache.uima.resource.ResourceInitializationException;
@@ -69,10 +46,25 @@ import org.cleartk.ml.DataWriter;
 import org.cleartk.ml.jar.DefaultDataWriterFactory;
 import org.cleartk.ml.jar.DirectoryDataWriterFactory;
 import org.cleartk.ml.jar.GenericJarClassifierFactory;
-import org.apache.uima.fit.factory.AnalysisEngineFactory;
-import org.apache.uima.fit.util.JCasUtil;
 
-import com.google.common.collect.Lists;
+import java.io.File;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+//import org.apache.ctakes.temporal.ae.feature.EventIndexOfSameSentenceRelationFeaturesExtractor;
+//import org.apache.ctakes.temporal.ae.feature.EventPositionRelationFeaturesExtractor;
+//import org.apache.ctakes.temporal.ae.feature.EventTimeRelationFeatureExtractor;
+//import org.apache.ctakes.temporal.ae.feature.SRLRelationFeaturesExtractor;
+//import org.apache.ctakes.temporal.ae.feature.SectionHeaderRelationExtractor;
+//import org.apache.ctakes.temporal.ae.feature.TimeWordTypeRelationExtractor;
+//import org.apache.ctakes.temporal.ae.feature.UnexpandedTokenFeaturesExtractor;
+//import org.apache.ctakes.temporal.ae.feature.TemporalAttributeFeatureExtractor;
+//import org.apache.ctakes.temporal.ae.feature.treekernel.EventTimeFlatTreeFeatureExtractor;
+//import org.apache.ctakes.temporal.ae.feature.treekernel.EventVerbRelationTreeExtractor;
+//import org.apache.ctakes.temporal.ae.feature.treekernel.TemporalPETExtractor;
+//import org.apache.ctakes.temporal.ae.feature.treekernel.TemporalPathExtractor;
 
 @PipeBitInfo(
 		name = "E-T TLinker",
@@ -83,6 +75,8 @@ import com.google.common.collect.Lists;
 )
 public class EventTimeRelationAnnotator extends RelationExtractorAnnotator {
 
+   static private final Logger LOGGER = Logger.getLogger( "EventTimeRelationAnnotator" );
+
 	public static AnalysisEngineDescription createDataWriterDescription(
 			Class<? extends DataWriter<String>> dataWriterClass,
 					File outputDirectory,
@@ -125,6 +119,17 @@ public class EventTimeRelationAnnotator
 				new File(modelDirectory, "model.jar"));
 	}
 
+   @Override
+   public void initialize( final UimaContext context ) throws ResourceInitializationException
{
+      LOGGER.info( "Initializing ..." );
+      try ( DotLogger dotter = new DotLogger() ) {
+         super.initialize( context );
+      } catch ( IOException ioE ) {
+         throw new ResourceInitializationException( ioE );
+      }
+      LOGGER.info( "Finished." );
+   }
+
 	@Override
 	protected List<RelationFeaturesExtractor<IdentifiedAnnotation,IdentifiedAnnotation>>
getFeatureExtractors() {
 		return Lists.newArrayList(

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/TemporalRelationExtractorAnnotator.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/TemporalRelationExtractorAnnotator.java?rev=1814586&r1=1814585&r2=1814586&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/TemporalRelationExtractorAnnotator.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/TemporalRelationExtractorAnnotator.java
Wed Nov  8 14:52:06 2017
@@ -21,31 +21,15 @@ package org.apache.ctakes.temporal.ae;
 //import java.io.File; //for normalization
 //import java.io.IOException;//for normalization
 //import java.net.URI;//for normalization
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Random;
-
-import org.apache.ctakes.relationextractor.ae.features.DependencyPathFeaturesExtractor;
-import org.apache.ctakes.relationextractor.ae.features.DependencyTreeFeaturesExtractor;
-import org.apache.ctakes.relationextractor.ae.features.NamedEntityFeaturesExtractor;
-import org.apache.ctakes.relationextractor.ae.features.PartOfSpeechFeaturesExtractor;
-import org.apache.ctakes.relationextractor.ae.features.PhraseChunkingExtractor;
-import org.apache.ctakes.relationextractor.ae.features.RelationFeaturesExtractor;
-import org.apache.ctakes.relationextractor.ae.features.TokenFeaturesExtractor;
-//import org.apache.ctakes.temporal.ae.feature.selection.ZscoreNormalizationExtractor;//for
normalization
-import org.apache.ctakes.temporal.utils.SoftMaxUtil;
+
+import com.google.common.collect.Lists;
+import org.apache.ctakes.relationextractor.ae.features.*;
 import org.apache.ctakes.typesystem.type.relation.BinaryTextRelation;
 import org.apache.ctakes.typesystem.type.relation.RelationArgument;
 import org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation;
 import org.apache.uima.UimaContext;
 import org.apache.uima.UimaContextAdmin;
 import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
-import org.apache.uima.cas.CASException;
 import org.apache.uima.fit.descriptor.ConfigurationParameter;
 import org.apache.uima.fit.util.JCasUtil;
 import org.apache.uima.jcas.JCas;
@@ -59,7 +43,10 @@ import org.cleartk.ml.Instance;
 import org.cleartk.ml.jar.GenericJarClassifierFactory;
 import org.cleartk.util.ViewUriUtil;
 
-import com.google.common.collect.Lists;
+import java.net.URL;
+import java.util.*;
+
+//import org.apache.ctakes.temporal.ae.feature.selection.ZscoreNormalizationExtractor;//for
normalization
 
 public abstract class TemporalRelationExtractorAnnotator extends CleartkAnnotator<String>
{
 
@@ -160,7 +147,8 @@ public abstract class TemporalRelationEx
 
 	@Override
 	public void initialize(UimaContext context) throws ResourceInitializationException {
-		allowClassifierModelOnClasspath(context);
+
+      allowClassifierModelOnClasspath(context);
 		super.initialize(context);
 		//		minmaxExtractor = createMinMaxNormalizationExtractor();
 		/**for normalization



Mime
View raw message