ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stevenbeth...@apache.org
Subject svn commit: r1585211 - in /ctakes/trunk: ctakes-temporal-res/src/main/resources/org/ ctakes-temporal-res/src/main/resources/org/apache/ ctakes-temporal-res/src/main/resources/org/apache/ctakes/ ctakes-temporal-res/src/main/resources/org/apache/ctakes/t...
Date Sat, 05 Apr 2014 22:54:19 GMT
Author: stevenbethard
Date: Sat Apr  5 22:54:19 2014
New Revision: 1585211

URL: http://svn.apache.org/r1585211
Log:
Adds trained EventAnnotator model and static createAnnotatorDescription() method for it. No
tests yet as it's unclear whether we want to load all the prerequisites (e.g. UMLS) within
a unit test. Also, all the other models are still missing.

Added:
    ctakes/trunk/ctakes-temporal-res/src/main/resources/org/
    ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/
    ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/
    ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/
    ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/ae/
    ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/ae/eventannotator/
    ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/ae/eventannotator/model.jar
  (with props)
Modified:
    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/eval/EvaluationOfEventSpans.java

Added: ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/ae/eventannotator/model.jar
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/ae/eventannotator/model.jar?rev=1585211&view=auto
==============================================================================
Binary file - no diff available.

Propchange: ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/ae/eventannotator/model.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

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=1585211&r1=1585210&r2=1585211&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
Sat Apr  5 22:54:19 2014
@@ -136,6 +136,18 @@ public class EventAnnotator extends Temp
         EventAnnotator.createFeatureSelectionURI(modelDirectory));
   }
 
+  public static AnalysisEngineDescription createAnnotatorDescription()
+      throws ResourceInitializationException {
+    return AnalysisEngineFactory.createPrimitiveDescription(
+        EventAnnotator.class,
+        CleartkAnnotator.PARAM_IS_TRAINING,
+        false,
+        GenericJarClassifierFactory.PARAM_CLASSIFIER_JAR_PATH,
+        String.format(
+            "/%s/model.jar",
+            EventAnnotator.class.getName().toLowerCase().replace('.', '/')));
+  }
+
   private BIOChunking<BaseToken, IdentifiedAnnotation> entityChunking;
 
   private BIOChunking<BaseToken, EventMention> eventChunking;

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventSpans.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventSpans.java?rev=1585211&r1=1585210&r2=1585211&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventSpans.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventSpans.java
Sat Apr  5 22:54:19 2014
@@ -19,6 +19,7 @@
 package org.apache.ctakes.temporal.eval;
 
 import java.io.File;
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 import java.util.logging.Level;
@@ -60,6 +61,16 @@ public class EvaluationOfEventSpans exte
     List<Integer> patientSets = options.getPatients().getList();
     List<Integer> trainItems = THYMEData.getTrainPatientSets(patientSets);
     List<Integer> devItems = THYMEData.getDevPatientSets(patientSets);
+    List<Integer> testItems = THYMEData.getTestPatientSets(patientSets);
+
+    List<Integer> allTraining = new ArrayList<Integer>(trainItems);
+    List<Integer> allTest = null;
+    if (options.getTest()) {
+      allTraining.addAll(devItems);
+      allTest = new ArrayList<Integer>(testItems);
+    } else {
+      allTest = new ArrayList<Integer>(devItems);
+    }
     EvaluationOfEventSpans evaluation = new EvaluationOfEventSpans(
         new File("target/eval/event-spans"),
         options.getRawTextDirectory(),
@@ -71,7 +82,7 @@ public class EvaluationOfEventSpans exte
         options.getSMOTENeighborNumber());
     evaluation.prepareXMIsFor(patientSets);
     evaluation.setLogging(Level.FINE, new File("target/eval/ctakes-event-errors.log"));
-    AnnotationStatistics<String> stats = evaluation.trainAndTest(trainItems, devItems);
+    AnnotationStatistics<String> stats = evaluation.trainAndTest(allTraining, allTest);
     System.err.println(stats);
   }
 



Mime
View raw message