ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tm...@apache.org
Subject svn commit: r1586138 - /ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfMetaTimeExpressionExtractor.java
Date Wed, 09 Apr 2014 20:40:38 GMT
Author: tmill
Date: Wed Apr  9 20:40:37 2014
New Revision: 1586138

URL: http://svn.apache.org/r1586138
Log:
CTAKES-82: Modify meta time expression extractor to read i2b2 data.

Modified:
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfMetaTimeExpressionExtractor.java

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfMetaTimeExpressionExtractor.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfMetaTimeExpressionExtractor.java?rev=1586138&r1=1586137&r2=1586138&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfMetaTimeExpressionExtractor.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfMetaTimeExpressionExtractor.java
Wed Apr  9 20:40:37 2014
@@ -12,6 +12,7 @@ import org.apache.ctakes.temporal.ae.CRF
 import org.apache.ctakes.temporal.ae.ConstituencyBasedTimeAnnotator;
 import org.apache.ctakes.temporal.ae.MetaTimeAnnotator;
 import org.apache.ctakes.temporal.ae.TimeAnnotator;
+import org.apache.ctakes.temporal.eval.Evaluation_ImplBase.XMLFormat;
 import org.apache.ctakes.typesystem.type.textsem.TimeMention;
 import org.apache.ctakes.typesystem.type.textspan.Segment;
 import org.apache.uima.analysis_engine.AnalysisEngine;
@@ -32,7 +33,7 @@ import com.google.common.collect.Maps;
 import com.lexicalscope.jewel.cli.CliFactory;
 
 public class EvaluationOfMetaTimeExpressionExtractor extends EvaluationOfAnnotationSpans_ImplBase
{
-  public static int nFolds = 2;
+  public static int nFolds = 5;
   private List<Integer> allTrain = null;
   
   public EvaluationOfMetaTimeExpressionExtractor(File baseDirectory,
@@ -48,9 +49,18 @@ public class EvaluationOfMetaTimeExpress
   public static void main(String[] args) throws Exception {
     Options options = CliFactory.parseArguments(Options.class, args);
     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> trainItems = null;
+    List<Integer> devItems = null;
+    List<Integer> testItems = null;
+    if(options.getXMLFormat() == XMLFormat.I2B2){
+      trainItems = I2B2Data.getTrainPatientSets(options.getXMLDirectory());
+      devItems = I2B2Data.getDevPatientSets(options.getXMLDirectory());
+      testItems = I2B2Data.getTestPatientSets(options.getXMLDirectory());
+    }else{
+      trainItems = THYMEData.getTrainPatientSets(patientSets);
+      devItems = THYMEData.getDevPatientSets(patientSets);
+      testItems = THYMEData.getTestPatientSets(patientSets);
+    }
     List<Integer> allTrain = new ArrayList<>(trainItems);
     List<Integer> allTest = null;
     
@@ -71,6 +81,7 @@ public class EvaluationOfMetaTimeExpress
             options.getTreebankDirectory(),
             allTrain,
             TimeMention.class);
+    if(options.getI2B2Output()!=null) eval.setI2B2Output(options.getI2B2Output());
     AnnotationStatistics<String> stats = eval.trainAndTest(allTrain, allTest);
     System.out.println(stats.toString());
   }



Mime
View raw message