ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tm...@apache.org
Subject svn commit: r1677161 - in /ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal: ae/ eval/
Date Fri, 01 May 2015 14:53:04 GMT
Author: tmill
Date: Fri May  1 14:53:03 2015
New Revision: 1677161

URL: http://svn.apache.org/r1677161
Log:
Added code to temporal readers and evals for handling THYME brain cancer corpus. Subcorpus is now an option to all the evals.

Modified:
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/THYMEKnowtatorXMLReader.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfAnnotationSpans_ImplBase.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfBothEEAndETRelations.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfClearTKEventProperties.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfClearTKEventSpans.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfClearTKRelations.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfClearTKTimeSpans.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventEventRelations.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventEventThymeRelations.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventProperties.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventSpans.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventTimeRelations.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfI2B2TemporalRelations.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfMetaTimeExpressionExtractor.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfNEPredicateEventSpans.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfSelfEventTimeRelations.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfTemporalRelations_ImplBase.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfTimeSpans.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/Evaluation_ImplBase.java

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/THYMEKnowtatorXMLReader.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/THYMEKnowtatorXMLReader.java?rev=1677161&r1=1677160&r2=1677161&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/THYMEKnowtatorXMLReader.java (original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/THYMEKnowtatorXMLReader.java Fri May  1 14:53:03 2015
@@ -58,8 +58,13 @@ public class THYMEKnowtatorXMLReader ext
   }
   
   @Override
-  protected URI getTextURI(JCas jCas) throws AnalysisEngineProcessException {
-    return ViewUriUtil.getURI(jCas);
+  protected URI getTextURI(JCas jCas) {
+    try {
+        return ViewUriUtil.getURI(jCas);
+    } catch (AnalysisEngineProcessException e){
+    	e.printStackTrace();
+    }
+    return null;
   }
 
   @Override
@@ -98,7 +103,7 @@ public class THYMEKnowtatorXMLReader ext
    */
   public static void main(String[] args) throws Exception {
     Options options = CliFactory.parseArguments(Options.class, args);
-    List<File> files = new ArrayList<File>();
+    List<File> files = new ArrayList<>();
     for (Integer set : options.getPatients().getList()) {
       File setTextDirectory = new File(options.getRawTextDirectory(), "doc" + set);
       for (File file : setTextDirectory.listFiles()) {

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfAnnotationSpans_ImplBase.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfAnnotationSpans_ImplBase.java?rev=1677161&r1=1677160&r2=1677161&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfAnnotationSpans_ImplBase.java (original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfAnnotationSpans_ImplBase.java Fri May  1 14:53:03 2015
@@ -77,10 +77,11 @@ Evaluation_ImplBase<AnnotationStatistics
 			File rawTextDirectory,
 			File xmlDirectory,
 			XMLFormat xmlFormat,
+			Subcorpus subcorpus,
 			File xmiDirectory,
 			File treebankDirectory,
 			Class<? extends Annotation> annotationClass) {
-		super(baseDirectory, rawTextDirectory, xmlDirectory, xmlFormat, xmiDirectory, treebankDirectory);
+		super(baseDirectory, rawTextDirectory, xmlDirectory, xmlFormat, subcorpus, xmiDirectory, treebankDirectory);
 		this.annotationClass = annotationClass;
 	}
 
@@ -89,9 +90,10 @@ Evaluation_ImplBase<AnnotationStatistics
 			File rawTextDirectory, 
 			File xmlDirectory,
 			XMLFormat xmlFormat,
+			Subcorpus subcorpus,
 			File xmiDirectory,
 			Class<? extends Annotation> annotationClass) {
-		this(baseDirectory,rawTextDirectory, xmlDirectory, xmlFormat, xmiDirectory, null, annotationClass);
+		this(baseDirectory,rawTextDirectory, xmlDirectory, xmlFormat, subcorpus, xmiDirectory, null, annotationClass);
 	}
 
 	protected abstract AnalysisEngineDescription getDataWriterDescription(File directory)
@@ -123,7 +125,7 @@ Evaluation_ImplBase<AnnotationStatistics
 		if(this.i2b2Output != null){
 			aggregateBuilder.add(AnalysisEngineFactory.createEngineDescription(WriteI2B2XML.class, WriteI2B2XML.PARAM_OUTPUT_DIR, this.i2b2Output), "TimexView", CAS.NAME_DEFAULT_SOFA);
 		}
-		AnnotationStatistics<String> stats = new AnnotationStatistics<String>();
+		AnnotationStatistics<String> stats = new AnnotationStatistics<>();
 		Ordering<Annotation> bySpans = Ordering.<Integer> natural().lexicographical().onResultOf(
 				new Function<Annotation, List<Integer>>() {
 					@Override
@@ -142,7 +144,7 @@ Evaluation_ImplBase<AnnotationStatistics
 					Collection<? extends Annotation> systemAnnotations = this.getSystemAnnotations(systemView, segment);
 					stats.add(goldAnnotations, systemAnnotations);
 
-					Set<Annotation> goldSet = new TreeSet<Annotation>(bySpans);
+					Set<Annotation> goldSet = new TreeSet<>(bySpans);
 					for (Annotation goldAnnotation : goldAnnotations) {
 						// TODO: fix data so that this is not necessary
 						if (goldAnnotation.getBegin() == Integer.MAX_VALUE || goldAnnotation.getEnd() == Integer.MIN_VALUE) {
@@ -152,21 +154,21 @@ Evaluation_ImplBase<AnnotationStatistics
 						goldSet.add(goldAnnotation);
 					}
 					//goldSet.addAll(goldAnnotations);
-					Set<Annotation> systemSet = new TreeSet<Annotation>(bySpans);
+					Set<Annotation> systemSet = new TreeSet<>(bySpans);
 					systemSet.addAll(systemAnnotations);
 
-					Set<Annotation> goldOnly = new TreeSet<Annotation>(bySpans);
+					Set<Annotation> goldOnly = new TreeSet<>(bySpans);
 					goldOnly.addAll(goldSet);
 					goldOnly.removeAll(systemSet);
 
-					Set<Annotation> systemOnly = new TreeSet<Annotation>(bySpans);
+					Set<Annotation> systemOnly = new TreeSet<>(bySpans);
 					systemOnly.addAll(systemSet);
 					systemOnly.removeAll(goldSet);
 
 					String text = jCas.getDocumentText().replaceAll("[\r\n]", " ");
 					if (!goldOnly.isEmpty() || !systemOnly.isEmpty()) {
 						this.logger.fine("Errors in : " + ViewUriUtil.getURI(jCas).toString());
-						Set<Annotation> errors = new TreeSet<Annotation>(bySpans);
+						Set<Annotation> errors = new TreeSet<>(bySpans);
 						errors.addAll(goldOnly);
 						errors.addAll(systemOnly);
 						for (Annotation annotation : errors) {
@@ -203,8 +205,8 @@ Evaluation_ImplBase<AnnotationStatistics
 							}
 						}
 					}
-					Set<Annotation> partialGold = new HashSet<Annotation>();
-					Set<Annotation> partialSystem = new HashSet<Annotation>();
+					Set<Annotation> partialGold = new HashSet<>();
+					Set<Annotation> partialSystem = new HashSet<>();
 
 					// get overlapping spans
 					if(this.printOverlapping){

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfBothEEAndETRelations.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfBothEEAndETRelations.java?rev=1677161&r1=1677160&r2=1677161&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfBothEEAndETRelations.java (original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfBothEEAndETRelations.java Fri May  1 14:53:03 2015
@@ -58,25 +58,25 @@ import org.apache.uima.analysis_engine.A
 import org.apache.uima.cas.CAS;
 import org.apache.uima.cas.CASException;
 import org.apache.uima.collection.CollectionReader;
+import org.apache.uima.fit.component.JCasAnnotator_ImplBase;
+import org.apache.uima.fit.descriptor.ConfigurationParameter;
+import org.apache.uima.fit.factory.AggregateBuilder;
+import org.apache.uima.fit.factory.AnalysisEngineFactory;
+import org.apache.uima.fit.pipeline.JCasIterator;
+import org.apache.uima.fit.pipeline.SimplePipeline;
+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;
 import org.apache.uima.util.FileUtils;
+import org.cleartk.eval.AnnotationStatistics;
 import org.cleartk.ml.jar.JarClassifierBuilder;
 import org.cleartk.ml.liblinear.LibLinearStringOutcomeDataWriter;
 //import org.cleartk.ml.libsvm.tk.TkLibSvmStringOutcomeDataWriter;
 //import org.cleartk.ml.libsvm.LIBSVMStringOutcomeDataWriter;
 //import org.cleartk.ml.tksvmlight.TKSVMlightStringOutcomeDataWriter;
 import org.cleartk.ml.tksvmlight.model.CompositeKernel.ComboOperator;
-import org.cleartk.eval.AnnotationStatistics;
 import org.cleartk.util.ViewUriUtil;
-import org.apache.uima.fit.component.JCasAnnotator_ImplBase;
-import org.apache.uima.fit.descriptor.ConfigurationParameter;
-import org.apache.uima.fit.factory.AggregateBuilder;
-import org.apache.uima.fit.factory.AnalysisEngineFactory;
-import org.apache.uima.fit.pipeline.JCasIterator;
-import org.apache.uima.fit.pipeline.SimplePipeline;
-import org.apache.uima.fit.util.JCasUtil;
 
 import com.google.common.base.Function;
 import com.google.common.collect.HashMultimap;
@@ -163,6 +163,7 @@ EvaluationOfTemporalRelations_ImplBase{
 					options.getRawTextDirectory(),
 					options.getXMLDirectory(),
 					options.getXMLFormat(),
+					options.getSubcorpus(),
 					options.getXMIDirectory(),
 					options.getTreebankDirectory(),
 					options.getClosure(),
@@ -234,6 +235,7 @@ EvaluationOfTemporalRelations_ImplBase{
 			File rawTextDirectory,
 			File xmlDirectory,
 			XMLFormat xmlFormat,
+			Subcorpus subcorpus,
 			File xmiDirectory,
 			File treebankDirectory,
 			boolean useClosure,
@@ -248,6 +250,7 @@ EvaluationOfTemporalRelations_ImplBase{
 				rawTextDirectory,
 				xmlDirectory,
 				xmlFormat,
+				subcorpus,
 				xmiDirectory,
 				treebankDirectory,
 				printErrors,

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfClearTKEventProperties.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfClearTKEventProperties.java?rev=1677161&r1=1677160&r2=1677161&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfClearTKEventProperties.java (original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfClearTKEventProperties.java Fri May  1 14:53:03 2015
@@ -20,7 +20,6 @@ package org.apache.ctakes.temporal.eval;
 
 import java.io.File;
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -84,6 +83,7 @@ public class EvaluationOfClearTKEventPro
         options.getRawTextDirectory(),
         options.getXMLDirectory(),
         options.getXMLFormat(),
+        options.getSubcorpus(),
         options.getXMIDirectory());
     evaluation.prepareXMIsFor(patientSets);
     evaluation.logClassificationErrors(new File("target/eval"), "ctakes-event-property-errors");
@@ -103,8 +103,9 @@ public class EvaluationOfClearTKEventPro
       File rawTextDirectory,
       File xmlDirectory,
       XMLFormat xmlFormat,
+      Subcorpus subcorpus,
       File xmiDirectory) {
-    super(baseDirectory, rawTextDirectory, xmlDirectory, xmlFormat, xmiDirectory, null);
+    super(baseDirectory, rawTextDirectory, xmlDirectory, xmlFormat, subcorpus, xmiDirectory, null);
     for (String name : PROPERTY_NAMES) {
       this.loggers.put(name, Logger.getLogger(String.format("%s.%s", this.getClass().getName(), name)));
     }
@@ -142,12 +143,12 @@ public class EvaluationOfClearTKEventPro
 
     Function<EventMention, ?> eventMentionToSpan = AnnotationStatistics.annotationToSpan();
     Map<String, Function<EventMention, String>> propertyGetters;
-    propertyGetters = new HashMap<String, Function<EventMention, String>>();
+    propertyGetters = new HashMap<>();
     for (String name : PROPERTY_NAMES) {
       propertyGetters.put(name, getPropertyGetter(name));
     }
 
-    Map<String, AnnotationStatistics<String>> statsMap = new HashMap<String, AnnotationStatistics<String>>();
+    Map<String, AnnotationStatistics<String>> statsMap = new HashMap<>();
     statsMap.put(DOC_TIME_REL, new AnnotationStatistics<String>());
     for (Iterator<JCas> casIter = new JCasIterator(collectionReader, aggregateBuilder.createAggregate()); casIter.hasNext();) {
       JCas jCas = casIter.next();

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfClearTKEventSpans.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfClearTKEventSpans.java?rev=1677161&r1=1677160&r2=1677161&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfClearTKEventSpans.java (original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfClearTKEventSpans.java Fri May  1 14:53:03 2015
@@ -19,7 +19,6 @@
 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;
@@ -58,6 +57,7 @@ public class EvaluationOfClearTKEventSpa
         options.getRawTextDirectory(),
         options.getXMLDirectory(),
         options.getXMLFormat(),
+        options.getSubcorpus(),
         options.getXMIDirectory());
     evaluation.prepareXMIsFor(patientSets);
     evaluation.setLogging(Level.FINE, new File("target/eval/cleartk-event-errors.log"));
@@ -70,8 +70,9 @@ public class EvaluationOfClearTKEventSpa
       File rawTextDirectory,
       File xmlDirectory,
       XMLFormat xmlFormat,
+      Subcorpus subcorpus,
       File xmiDirectory) {
-    super(baseDirectory, rawTextDirectory, xmlDirectory, xmlFormat, xmiDirectory, EventMention.class);
+    super(baseDirectory, rawTextDirectory, xmlDirectory, xmlFormat, subcorpus, xmiDirectory, EventMention.class);
   }
 
   @Override

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfClearTKRelations.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfClearTKRelations.java?rev=1677161&r1=1677160&r2=1677161&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfClearTKRelations.java (original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfClearTKRelations.java Fri May  1 14:53:03 2015
@@ -19,7 +19,6 @@
 package org.apache.ctakes.temporal.eval;
 
 import java.io.File;
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
@@ -90,6 +89,7 @@ public class EvaluationOfClearTKRelation
         options.getRawTextDirectory(),
         options.getXMLDirectory(),
         options.getXMLFormat(),
+        options.getSubcorpus(),
         options.getXMIDirectory());
     evaluation.setExtractEventEvent(!options.getIgnoreEventEvent());
     evaluation.setExtractEventTime(!options.getIgnoreEventTime());
@@ -104,8 +104,9 @@ public class EvaluationOfClearTKRelation
   public EvaluationOfClearTKRelations(File baseDirectory, File rawTextDirectory,
       File xmlDirectory,
       org.apache.ctakes.temporal.eval.Evaluation_ImplBase.XMLFormat xmlFormat,
+      Subcorpus subcorpus,
       File xmiDirectory) {
-    super(baseDirectory, rawTextDirectory, xmlDirectory, xmlFormat, xmiDirectory, null, false, false, defaultParams);
+    super(baseDirectory, rawTextDirectory, xmlDirectory, xmlFormat, subcorpus, xmiDirectory, null, false, false, defaultParams);
   }
   
   private void setExtractEventTime(boolean eventTime) {
@@ -177,7 +178,7 @@ public class EvaluationOfClearTKRelation
       }
     };
     Function<BinaryTextRelation, String> getOutcome = AnnotationStatistics.annotationToFeatureValue("category");
-    AnnotationStatistics<String> stats = new AnnotationStatistics<String>();
+    AnnotationStatistics<String> stats = new AnnotationStatistics<>();
     for (Iterator<JCas> casIter = new JCasIterator(collectionReader, aggregateBuilder.createAggregate()); casIter.hasNext();) {
       JCas jCas = casIter.next();
       JCas goldView = jCas.getView(GOLD_VIEW_NAME);

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfClearTKTimeSpans.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfClearTKTimeSpans.java?rev=1677161&r1=1677160&r2=1677161&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfClearTKTimeSpans.java (original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfClearTKTimeSpans.java Fri May  1 14:53:03 2015
@@ -19,7 +19,6 @@
 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;
@@ -58,6 +57,7 @@ public class EvaluationOfClearTKTimeSpan
         options.getRawTextDirectory(),
         options.getXMLDirectory(),
         options.getXMLFormat(),
+        options.getSubcorpus(),
         options.getXMIDirectory());
     evaluation.prepareXMIsFor(patientSets);
     evaluation.setLogging(Level.FINE, new File("target/eval/cleartk-time-errors.log"));
@@ -70,8 +70,9 @@ public class EvaluationOfClearTKTimeSpan
       File rawTextDirectory,
       File xmlDirectory,
       XMLFormat xmlFormat,
+      Subcorpus subcorpus,
       File xmiDirectory) {
-    super(baseDirectory, rawTextDirectory, xmlDirectory, xmlFormat, xmiDirectory, EventMention.class);
+    super(baseDirectory, rawTextDirectory, xmlDirectory, xmlFormat, subcorpus, xmiDirectory, EventMention.class);
   }
 
   @Override

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventEventRelations.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventEventRelations.java?rev=1677161&r1=1677160&r2=1677161&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventEventRelations.java (original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventEventRelations.java Fri May  1 14:53:03 2015
@@ -64,13 +64,14 @@ EvaluationOfTemporalRelations_ImplBase {
       File rawTextDirectory,
       File xmlDirectory,
       XMLFormat xmlFormat,
+      Subcorpus subcorpus,
       File xmiDirectory,
       File treebankDirectory,
       boolean printErrors,
       boolean printRelations,
       boolean baseline,
       ParameterSettings params){
-    super(baseDirectory, rawTextDirectory, xmlDirectory, xmlFormat, xmiDirectory,
+    super(baseDirectory, rawTextDirectory, xmlDirectory, xmlFormat, subcorpus, xmiDirectory,
         treebankDirectory, printErrors, printRelations, params);
     this.baseline = baseline;
   }
@@ -206,6 +207,7 @@ EvaluationOfTemporalRelations_ImplBase {
         options.getRawTextDirectory(),
         options.getXMLDirectory(),
         options.getXMLFormat(),
+        options.getSubcorpus(),
         options.getXMIDirectory(),
         options.getTreebankDirectory(),
         options.getPrintErrors(),

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventEventThymeRelations.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventEventThymeRelations.java?rev=1677161&r1=1677160&r2=1677161&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventEventThymeRelations.java (original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventEventThymeRelations.java Fri May  1 14:53:03 2015
@@ -161,6 +161,7 @@ EvaluationOfTemporalRelations_ImplBase{
 					options.getRawTextDirectory(),
 					options.getXMLDirectory(),
 					options.getXMLFormat(),
+					options.getSubcorpus(),
 					options.getXMIDirectory(),
 					options.getTreebankDirectory(),
 					options.getClosure(),
@@ -232,6 +233,7 @@ EvaluationOfTemporalRelations_ImplBase{
 			File rawTextDirectory,
 			File xmlDirectory,
 			XMLFormat xmlFormat,
+			Subcorpus subcorpus,
 			File xmiDirectory,
 			File treebankDirectory,
 			boolean useClosure,
@@ -246,6 +248,7 @@ EvaluationOfTemporalRelations_ImplBase{
 				rawTextDirectory,
 				xmlDirectory,
 				xmlFormat,
+				subcorpus,
 				xmiDirectory,
 				treebankDirectory,
 				printErrors,

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventProperties.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventProperties.java?rev=1677161&r1=1677160&r2=1677161&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventProperties.java (original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventProperties.java Fri May  1 14:53:03 2015
@@ -20,7 +20,6 @@ package org.apache.ctakes.temporal.eval;
 
 import java.io.File;
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -42,7 +41,6 @@ import org.apache.uima.analysis_engine.A
 import org.apache.uima.cas.CAS;
 import org.apache.uima.cas.Feature;
 import org.apache.uima.collection.CollectionReader;
-import org.apache.uima.fit.component.JCasAnnotator_ImplBase;
 import org.apache.uima.fit.factory.AggregateBuilder;
 import org.apache.uima.fit.factory.AnalysisEngineFactory;
 import org.apache.uima.fit.pipeline.JCasIterator;
@@ -109,6 +107,7 @@ Evaluation_ImplBase<Map<String, Annotati
 					options.getRawTextDirectory(),
 					options.getXMLDirectory(),
 					options.getXMLFormat(),
+					options.getSubcorpus(),
 					options.getXMIDirectory());
 			evaluation.skipTrain = options.getSkipTrain();
 			if(evaluation.skipTrain && options.getTest()){
@@ -144,8 +143,9 @@ Evaluation_ImplBase<Map<String, Annotati
 			File rawTextDirectory,
 			File xmlDirectory,
 			XMLFormat xmlFormat,
+			Subcorpus subcorpus,
 			File xmiDirectory) {
-		super(baseDirectory, rawTextDirectory, xmlDirectory, xmlFormat, xmiDirectory, null);
+		super(baseDirectory, rawTextDirectory, xmlDirectory, xmlFormat, subcorpus, xmiDirectory, null);
 		for (String name : PROPERTY_NAMES) {
 			this.loggers.put(name, Logger.getLogger(String.format("%s.%s", this.getClass().getName(), name)));
 		}

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=1677161&r1=1677160&r2=1677161&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 Fri May  1 14:53:03 2015
@@ -73,19 +73,20 @@ public class EvaluationOfEventSpans exte
       testItems = THYMEData.getPatientSets(patientSets, options.getTestRemainders().getList());
     }
     
-    List<Integer> allTraining = new ArrayList<Integer>(trainItems);
+    List<Integer> allTraining = new ArrayList<>(trainItems);
     List<Integer> allTest = null;
     if (options.getTest()) {
       allTraining.addAll(devItems);
-      allTest = new ArrayList<Integer>(testItems);
+      allTest = new ArrayList<>(testItems);
     } else {
-      allTest = new ArrayList<Integer>(devItems);
+      allTest = new ArrayList<>(devItems);
     }
     EvaluationOfEventSpans evaluation = new EvaluationOfEventSpans(
         new File("target/eval/event-spans"),
         options.getRawTextDirectory(),
         options.getXMLDirectory(),
         options.getXMLFormat(),
+        options.getSubcorpus(),
         options.getXMIDirectory(),
         options.getProbabilityOfKeepingANegativeExample(),
         options.getFeatureSelectionThreshold(),
@@ -108,11 +109,12 @@ public class EvaluationOfEventSpans exte
       File rawTextDirectory,
       File xmlDirectory,
       XMLFormat xmlFormat,
+      Subcorpus subcorpus,
       File xmiDirectory,
       float probabilityOfKeepingANegativeExample,
       float featureSelectionThreshold,
       float numOfSmoteNeighbors) {
-    super(baseDirectory, rawTextDirectory, xmlDirectory, xmlFormat, xmiDirectory, EventMention.class);
+    super(baseDirectory, rawTextDirectory, xmlDirectory, xmlFormat, subcorpus, xmiDirectory, EventMention.class);
     this.probabilityOfKeepingANegativeExample = probabilityOfKeepingANegativeExample;
     this.featureSelectionThreshold = featureSelectionThreshold;
     this.smoteNeighborNumber = numOfSmoteNeighbors;

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventTimeRelations.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventTimeRelations.java?rev=1677161&r1=1677160&r2=1677161&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventTimeRelations.java (original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventTimeRelations.java Fri May  1 14:53:03 2015
@@ -35,9 +35,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-import org.apache.ctakes.relationextractor.ae.RelationExtractorAnnotator.IdentifiedAnnotationPair;
 import org.apache.ctakes.relationextractor.eval.RelationExtractorEvaluation.HashableArguments;
-import org.apache.ctakes.temporal.ae.EventTimeRelationAnnotator;
 import org.apache.ctakes.temporal.ae.EventTimeSelfRelationAnnotator;
 //import org.apache.ctakes.temporal.ae.EventTimeSyntacticAnnotator;
 //import org.apache.ctakes.temporal.ae.EventTimeRelationAnnotator;
@@ -60,25 +58,25 @@ import org.apache.uima.analysis_engine.A
 import org.apache.uima.cas.CAS;
 import org.apache.uima.cas.CASException;
 import org.apache.uima.collection.CollectionReader;
+import org.apache.uima.fit.component.JCasAnnotator_ImplBase;
+import org.apache.uima.fit.descriptor.ConfigurationParameter;
+import org.apache.uima.fit.factory.AggregateBuilder;
+import org.apache.uima.fit.factory.AnalysisEngineFactory;
+import org.apache.uima.fit.pipeline.JCasIterator;
+import org.apache.uima.fit.pipeline.SimplePipeline;
+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;
 import org.apache.uima.util.FileUtils;
+import org.cleartk.eval.AnnotationStatistics;
 import org.cleartk.ml.jar.JarClassifierBuilder;
 import org.cleartk.ml.liblinear.LibLinearStringOutcomeDataWriter;
 //import org.cleartk.ml.libsvm.LibSvmStringOutcomeDataWriter;
 //import org.cleartk.ml.tksvmlight.TkSvmLightStringOutcomeDataWriter;
 import org.cleartk.ml.tksvmlight.model.CompositeKernel;
 import org.cleartk.ml.tksvmlight.model.CompositeKernel.ComboOperator;
-import org.cleartk.eval.AnnotationStatistics;
 import org.cleartk.util.ViewUriUtil;
-import org.apache.uima.fit.component.JCasAnnotator_ImplBase;
-import org.apache.uima.fit.descriptor.ConfigurationParameter;
-import org.apache.uima.fit.factory.AggregateBuilder;
-import org.apache.uima.fit.factory.AnalysisEngineFactory;
-import org.apache.uima.fit.pipeline.JCasIterator;
-import org.apache.uima.fit.pipeline.SimplePipeline;
-import org.apache.uima.fit.util.JCasUtil;
 
 import com.google.common.base.Function;
 import com.google.common.collect.HashMultimap;
@@ -165,6 +163,7 @@ EvaluationOfTemporalRelations_ImplBase{
 					options.getRawTextDirectory(),
 					options.getXMLDirectory(),
 					options.getXMLFormat(),
+					options.getSubcorpus(),
 					options.getXMIDirectory(),
 					options.getTreebankDirectory(),
 					options.getClosure(),
@@ -236,6 +235,7 @@ EvaluationOfTemporalRelations_ImplBase{
 			File rawTextDirectory,
 			File xmlDirectory,
 			XMLFormat xmlFormat,
+			Subcorpus subcorpus,
 			File xmiDirectory,
 			File treebankDirectory,
 			boolean useClosure,
@@ -250,6 +250,7 @@ EvaluationOfTemporalRelations_ImplBase{
 				rawTextDirectory,
 				xmlDirectory,
 				xmlFormat,
+				subcorpus,
 				xmiDirectory,
 				treebankDirectory,
 				printErrors,

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfI2B2TemporalRelations.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfI2B2TemporalRelations.java?rev=1677161&r1=1677160&r2=1677161&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfI2B2TemporalRelations.java (original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfI2B2TemporalRelations.java Fri May  1 14:53:03 2015
@@ -24,12 +24,10 @@ import java.io.FileWriter;
 import java.io.IOException;
 import java.io.PrintWriter;
 import java.net.URI;
-import java.util.ArrayDeque;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.Deque;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -38,12 +36,12 @@ import org.apache.ctakes.core.ae.CDASegm
 import org.apache.ctakes.relationextractor.eval.RelationExtractorEvaluation.HashableArguments;
 import org.apache.ctakes.temporal.ae.ConsecutiveSentencesEventEventRelationAnnotator;
 import org.apache.ctakes.temporal.ae.ConsecutiveSentencesEventTimeRelationAnnotator;
-import org.apache.ctakes.temporal.ae.TemporalRelationRuleAnnotator;
 import org.apache.ctakes.temporal.ae.DocTimeRelAnnotator;
 import org.apache.ctakes.temporal.ae.EventAdmissionTimeAnnotator;
 import org.apache.ctakes.temporal.ae.EventDischargeTimeAnnotator;
 import org.apache.ctakes.temporal.ae.EventEventI2B2RelationAnnotator;
 import org.apache.ctakes.temporal.ae.EventTimeI2B2RelationAnnotator;
+import org.apache.ctakes.temporal.ae.TemporalRelationRuleAnnotator;
 import org.apache.ctakes.temporal.ae.baselines.RecallBaselineEventTimeRelationAnnotator;
 import org.apache.ctakes.temporal.eval.EvaluationOfEventEventThymeRelations.AddEEPotentialRelations;
 import org.apache.ctakes.temporal.eval.EvaluationOfEventTimeRelations.AddPotentialRelations;
@@ -55,18 +53,16 @@ import org.apache.ctakes.typesystem.type
 import org.apache.ctakes.typesystem.type.relation.RelationArgument;
 import org.apache.ctakes.typesystem.type.relation.TemporalTextRelation;
 import org.apache.ctakes.typesystem.type.textsem.EventMention;
-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.uima.analysis_engine.AnalysisEngineProcessException;
-import org.apache.uima.fit.pipeline.JCasIterator;
 import org.apache.uima.cas.CAS;
 import org.apache.uima.cas.CASException;
 import org.apache.uima.collection.CollectionReader;
 import org.apache.uima.fit.component.JCasAnnotator_ImplBase;
-import org.apache.uima.fit.descriptor.ConfigurationParameter;
 import org.apache.uima.fit.factory.AggregateBuilder;
 import org.apache.uima.fit.factory.AnalysisEngineFactory;
+import org.apache.uima.fit.pipeline.JCasIterator;
 import org.apache.uima.fit.pipeline.SimplePipeline;
 import org.apache.uima.fit.util.JCasUtil;
 import org.apache.uima.jcas.JCas;
@@ -76,16 +72,9 @@ import org.apache.uima.util.FileUtils;
 import org.cleartk.eval.AnnotationStatistics;
 import org.cleartk.ml.jar.JarClassifierBuilder;
 import org.cleartk.ml.libsvm.LibSvmStringOutcomeDataWriter;
-import org.cleartk.ml.liblinear.LibLinearStringOutcomeDataWriter;
 //import org.cleartk.classifier.tksvmlight.TKSVMlightStringOutcomeDataWriter;
 import org.cleartk.ml.tksvmlight.model.CompositeKernel.ComboOperator;
 import org.cleartk.util.ViewUriUtil;
-import org.apache.uima.fit.component.JCasAnnotator_ImplBase;
-import org.apache.uima.fit.descriptor.ConfigurationParameter;
-import org.apache.uima.fit.factory.AggregateBuilder;
-import org.apache.uima.fit.factory.AnalysisEngineFactory;
-import org.apache.uima.fit.pipeline.SimplePipeline;
-import org.apache.uima.fit.util.JCasUtil;
 
 import com.google.common.base.Function;
 import com.google.common.collect.HashMultimap;
@@ -180,6 +169,7 @@ EvaluationOfTemporalRelations_ImplBase{
 					options.getRawTextDirectory(),
 					options.getXMLDirectory(),
 					options.getXMLFormat(),
+					options.getSubcorpus(),
 					options.getXMIDirectory(),
 					options.getTreebankDirectory(),
 					options.getClosure(),
@@ -226,6 +216,7 @@ EvaluationOfTemporalRelations_ImplBase{
 			File rawTextDirectory,
 			File xmlDirectory,
 			XMLFormat xmlFormat,
+			Subcorpus subcorpus,
 			File xmiDirectory,
 			File treebankDirectory,
 			boolean useClosure,
@@ -240,6 +231,7 @@ EvaluationOfTemporalRelations_ImplBase{
 				rawTextDirectory,
 				xmlDirectory,
 				xmlFormat,
+				subcorpus,
 				xmiDirectory,
 				treebankDirectory,
 				printErrors,

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=1677161&r1=1677160&r2=1677161&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 Fri May  1 14:53:03 2015
@@ -63,9 +63,9 @@ public class EvaluationOfMetaTimeExpress
   public EvaluationOfMetaTimeExpressionExtractor(File baseDirectory,
       File rawTextDirectory, File xmlDirectory,
       org.apache.ctakes.temporal.eval.Evaluation_ImplBase.XMLFormat xmlFormat,
-      File xmiDirectory, File treebankDirectory,
+      Subcorpus subcorpus, File xmiDirectory, File treebankDirectory,
       List<Integer> allTrain, Class<? extends Annotation> annotationClass) {
-    super(baseDirectory, rawTextDirectory, xmlDirectory, xmlFormat, xmiDirectory,
+    super(baseDirectory, rawTextDirectory, xmlDirectory, xmlFormat, subcorpus, xmiDirectory,
         treebankDirectory, annotationClass);
     this.allTrain = allTrain;
   }
@@ -101,6 +101,7 @@ public class EvaluationOfMetaTimeExpress
             options.getRawTextDirectory(), 
             options.getXMLDirectory(), 
             options.getXMLFormat(),
+            options.getSubcorpus(),
             options.getXMIDirectory(), 
             options.getTreebankDirectory(),
             allTrain,
@@ -142,6 +143,7 @@ public class EvaluationOfMetaTimeExpress
               this.rawTextDirectory,
               this.xmlDirectory,
               this.xmlFormat,
+              this.subcorpus,
               this.xmiDirectory,
               this.treebankDirectory,
               1,

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfNEPredicateEventSpans.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfNEPredicateEventSpans.java?rev=1677161&r1=1677160&r2=1677161&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfNEPredicateEventSpans.java (original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfNEPredicateEventSpans.java Fri May  1 14:53:03 2015
@@ -41,18 +41,18 @@ public class EvaluationOfNEPredicateEven
 
 	public EvaluationOfNEPredicateEventSpans(File baseDirectory,
 			File rawTextDirectory, File xmlDirectory, XMLFormat xmlFormat,
-			File xmiDirectory, File treebankDirectory,
+			Subcorpus subcorpus, File xmiDirectory, File treebankDirectory,
 			Class<? extends Annotation> annotationClass) {
 		super(baseDirectory, rawTextDirectory, xmlDirectory, xmlFormat,
-				xmiDirectory, treebankDirectory, annotationClass);
+				subcorpus, xmiDirectory, treebankDirectory, annotationClass);
 		// TODO Auto-generated constructor stub
 	}
 
 	public EvaluationOfNEPredicateEventSpans(File baseDirectory,
 			File rawTextDirectory, File xmlDirectory, XMLFormat xmlFormat,
-			File xmiDirectory) {
+			Subcorpus subcorpus, File xmiDirectory) {
 		super(baseDirectory, rawTextDirectory, xmlDirectory, xmlFormat,
-				xmiDirectory, EventMention.class);
+				subcorpus, xmiDirectory, EventMention.class);
 		// TODO Auto-generated constructor stub
 	}
 
@@ -100,6 +100,7 @@ public class EvaluationOfNEPredicateEven
 	        options.getRawTextDirectory(),
 	        options.getXMLDirectory(),
 	        options.getXMLFormat(),
+	        options.getSubcorpus(),
 	        options.getXMIDirectory());
 	    evaluation.prepareXMIsFor(patientSets);
 	    evaluation.setLogging(Level.FINE, new File("target/eval/ctakes-event-errors.log"));

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfSelfEventTimeRelations.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfSelfEventTimeRelations.java?rev=1677161&r1=1677160&r2=1677161&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfSelfEventTimeRelations.java (original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfSelfEventTimeRelations.java Fri May  1 14:53:03 2015
@@ -165,6 +165,7 @@ EvaluationOfTemporalRelations_ImplBase{
 					options.getRawTextDirectory(),
 					options.getXMLDirectory(),
 					options.getXMLFormat(),
+					options.getSubcorpus(),
 					options.getXMIDirectory(),
 					options.getTreebankDirectory(),
 					options.getClosure(),
@@ -242,6 +243,7 @@ EvaluationOfTemporalRelations_ImplBase{
 			File rawTextDirectory,
 			File xmlDirectory,
 			XMLFormat xmlFormat,
+			Subcorpus subcorpus,
 			File xmiDirectory,
 			File treebankDirectory,
 			boolean useClosure,
@@ -256,6 +258,7 @@ EvaluationOfTemporalRelations_ImplBase{
 				rawTextDirectory,
 				xmlDirectory,
 				xmlFormat,
+				subcorpus,
 				xmiDirectory,
 				treebankDirectory,
 				printErrors,

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfTemporalRelations_ImplBase.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfTemporalRelations_ImplBase.java?rev=1677161&r1=1677160&r2=1677161&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfTemporalRelations_ImplBase.java (original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfTemporalRelations_ImplBase.java Fri May  1 14:53:03 2015
@@ -47,7 +47,7 @@ import com.lexicalscope.jewel.cli.Option
 public abstract class EvaluationOfTemporalRelations_ImplBase extends
 Evaluation_ImplBase<AnnotationStatistics<String>> {
 
-	static interface TempRelOptions extends Evaluation_ImplBase.Options{
+	public static interface TempRelOptions extends Evaluation_ImplBase.Options{
 		@Option
 		public boolean getTest();
 
@@ -80,9 +80,9 @@ Evaluation_ImplBase<AnnotationStatistics
 	protected boolean printRelations = false;
 
 	public EvaluationOfTemporalRelations_ImplBase(File baseDirectory,
-			File rawTextDirectory, File xmlDirectory, XMLFormat xmlFormat,
+			File rawTextDirectory, File xmlDirectory, XMLFormat xmlFormat, Subcorpus subcorpus,
 			File xmiDirectory, File treebankDirectory, boolean printErrors, boolean printRelations, ParameterSettings params) {
-		super(baseDirectory, rawTextDirectory, xmlDirectory, xmlFormat, xmiDirectory,
+		super(baseDirectory, rawTextDirectory, xmlDirectory, xmlFormat, subcorpus, xmiDirectory,
 				treebankDirectory);
 		this.params = params;
 		this.printRelations = printRelations;

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfTimeSpans.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfTimeSpans.java?rev=1677161&r1=1677160&r2=1677161&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfTimeSpans.java (original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfTimeSpans.java Fri May  1 14:53:03 2015
@@ -104,14 +104,14 @@ public class EvaluationOfTimeSpans exten
       testItems = THYMEData.getPatientSets(patientSets, options.getTestRemainders().getList());
     }
 		
-		List<Integer> allTrain = new ArrayList<Integer>(trainItems);
+		List<Integer> allTrain = new ArrayList<>(trainItems);
 		List<Integer> allTest = null;
 		
 		if(options.getTest()){
 		  allTrain.addAll(devItems);
-		  allTest = new ArrayList<Integer>(testItems);
+		  allTest = new ArrayList<>(testItems);
 		}else{
-		  allTest = new ArrayList<Integer>(devItems);
+		  allTest = new ArrayList<>(devItems);
 		}
 		
 		// specify the annotator classes to use
@@ -131,7 +131,7 @@ public class EvaluationOfTimeSpans exten
 		
 		// THYME best params: Backwards: 0.1, CRF 0.3, Time 0.1, Constituency 0.3
 		// i2b2 best params: Backwards 0.1, CRF 3.0, Time 0.1, Constituency 0.3
-		String gridParam = "0.01";
+//		String gridParam = "0.01";
 		annotatorTrainingArguments.put(BackwardsTimeAnnotator.class, new String[]{"-c", "0.1"});
 		annotatorTrainingArguments.put(TimeAnnotator.class, new String[]{"-c", "0.1"});
 		annotatorTrainingArguments.put(ConstituencyBasedTimeAnnotator.class, new String[]{"-c", "0.3"});
@@ -145,6 +145,7 @@ public class EvaluationOfTimeSpans exten
 					options.getRawTextDirectory(),
 					options.getXMLDirectory(),
 					options.getXMLFormat(),
+					options.getSubcorpus(),
 					options.getXMIDirectory(),
 					options.getTreebankDirectory(),
 					options.getFeatureSelectionThreshold(),
@@ -194,6 +195,7 @@ public class EvaluationOfTimeSpans exten
 			File rawTextDirectory,
 			File xmlDirectory,
 			XMLFormat xmlFormat,
+			Subcorpus subcorpus,
 			File xmiDirectory,
 			File treebankDirectory,
 			float featureSelectionThreshold,
@@ -201,7 +203,7 @@ public class EvaluationOfTimeSpans exten
 			Class<? extends JCasAnnotator_ImplBase> annotatorClass,
 					boolean printOverlapping,
 					String[] trainingArguments) {
-		super(baseDirectory, rawTextDirectory, xmlDirectory, xmlFormat, xmiDirectory, treebankDirectory, TimeMention.class);
+		super(baseDirectory, rawTextDirectory, xmlDirectory, xmlFormat, subcorpus, xmiDirectory, treebankDirectory, TimeMention.class);
 		this.annotatorClass = annotatorClass;
 		this.featureSelectionThreshold = featureSelectionThreshold;
 		this.trainingArguments = trainingArguments;

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/Evaluation_ImplBase.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/Evaluation_ImplBase.java?rev=1677161&r1=1677160&r2=1677161&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/Evaluation_ImplBase.java (original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/Evaluation_ImplBase.java Fri May  1 14:53:03 2015
@@ -24,6 +24,9 @@ import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.FilenameFilter;
 import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.MalformedURLException;
+import java.net.URI;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -56,7 +59,6 @@ import org.apache.ctakes.core.resource.F
 import org.apache.ctakes.core.resource.FileResourceImpl;
 import org.apache.ctakes.dependency.parser.ae.ClearNLPDependencyParserAE;
 import org.apache.ctakes.dependency.parser.ae.ClearNLPSemanticRoleLabelerAE;
-import org.apache.ctakes.dictionary.lookup.ae.UmlsDictionaryLookupAnnotator;
 import org.apache.ctakes.dictionary.lookup2.ae.AbstractJCasTermAnnotator;
 import org.apache.ctakes.dictionary.lookup2.ae.DefaultJCasTermAnnotator;
 import org.apache.ctakes.dictionary.lookup2.ae.JCasTermAnnotator;
@@ -116,6 +118,7 @@ import org.xml.sax.ContentHandler;
 import org.xml.sax.SAXException;
 
 import com.google.common.collect.Lists;
+import com.google.common.io.CharStreams;
 import com.lexicalscope.jewel.cli.Option;
 
 public abstract class Evaluation_ImplBase<STATISTICS_TYPE> extends
@@ -125,9 +128,11 @@ org.cleartk.eval.Evaluation_ImplBase<Int
 
 	public static final String GOLD_VIEW_NAME = "GoldView";
 
-	enum XMLFormat { Knowtator, Anafora, I2B2 }
+	public enum XMLFormat { Knowtator, Anafora, I2B2 }
 
-	static interface Options {
+	public enum Subcorpus { Colon, Brain}
+	
+  public static interface Options {
 
 		@Option(longName = "text", defaultToNull = true)
 		public File getRawTextDirectory();
@@ -138,6 +143,9 @@ org.cleartk.eval.Evaluation_ImplBase<Int
 		@Option(longName = "format", defaultValue="Anafora")
 		public XMLFormat getXMLFormat();
 
+		@Option(longName = "subcorpus", defaultValue="Colon")
+		public Subcorpus getSubcorpus();
+
 		@Option(longName = "xmi")
 		public File getXMIDirectory();
 
@@ -204,6 +212,8 @@ org.cleartk.eval.Evaluation_ImplBase<Int
 
 	protected XMLFormat xmlFormat;
 
+	protected Subcorpus subcorpus;
+	
 	protected File xmiDirectory;
 
 	private boolean xmiExists;
@@ -223,12 +233,14 @@ org.cleartk.eval.Evaluation_ImplBase<Int
 			File rawTextDirectory,
 			File xmlDirectory,
 			XMLFormat xmlFormat,
+			Subcorpus subcorpus,
 			File xmiDirectory,
 			File treebankDirectory) {
 		super(baseDirectory);
 		this.rawTextDirectory = rawTextDirectory;
 		this.xmlDirectory = xmlDirectory;
 		this.xmlFormat = xmlFormat;
+		this.subcorpus = subcorpus;
 		this.xmiDirectory = xmiDirectory;
 		this.xmiExists = this.xmiDirectory.exists() && this.xmiDirectory.listFiles().length > 0;
 		this.treebankDirectory = treebankDirectory;
@@ -259,13 +271,21 @@ org.cleartk.eval.Evaluation_ImplBase<Int
 		if (this.xmlFormat == XMLFormat.Anafora) {
 			Set<String> ids = new HashSet<>();
 			for (Integer set : patientSets) {
-				ids.add(String.format("ID%03d", set));
+			  if(this.subcorpus == Subcorpus.Colon){
+			    ids.add(String.format("ID%03d", set));
+			  }else{
+			    ids.add(String.format("doc%04d", set));
+			  }
+			}
+			int filePrefixLen = 5; // Colon: "ID\d{3}"
+			if(this.subcorpus == Subcorpus.Brain){
+			  filePrefixLen = 7; // Brain: "doc\d{4}"
 			}
 			for (String section : THYMEData.SECTIONS){
 				File xmlSubdir = new File(this.xmlDirectory, section);
 				for (File dir : xmlSubdir.listFiles()) {
 					if (dir.isDirectory()) {
-						if (ids.contains(dir.getName().substring(0, 5))) {
+						if (ids.contains(dir.getName().substring(0, filePrefixLen))) {
 							File file = new File(dir, dir.getName());
 							if (file.exists()) {
 								files.add(file);
@@ -345,7 +365,7 @@ org.cleartk.eval.Evaluation_ImplBase<Int
 	protected AggregateBuilder getXMIWritingPreprocessorAggregateBuilder()
 			throws Exception {
 		AggregateBuilder aggregateBuilder = new AggregateBuilder();
-		aggregateBuilder.add(UriToDocumentTextAnnotator.getDescription());
+		aggregateBuilder.add(AnalysisEngineFactory.createEngineDescription(UriToDocumentTextAnnotatorCtakes.class));
 
 		// read manual annotations into gold view
 		aggregateBuilder.add(AnalysisEngineFactory.createEngineDescription(
@@ -440,9 +460,19 @@ org.cleartk.eval.Evaluation_ImplBase<Int
 				"DeleteAction",
 				new String[] { "selector=B" }));
 		// add UMLS on top of lookup windows
-		aggregateBuilder.add(
-				UmlsDictionaryLookupAnnotator.createAnnotatorDescription()
-				);
+    try {
+      aggregateBuilder.add(AnalysisEngineFactory.createEngineDescription(DefaultJCasTermAnnotator.class,
+          AbstractJCasTermAnnotator.PARAM_WINDOW_ANNOT_PRP,
+          "org.apache.ctakes.typesystem.type.textspan.Sentence",
+          JCasTermAnnotator.DICTIONARY_DESCRIPTOR_KEY,
+          ExternalResourceFactory.createExternalResourceDescription(
+              FileResourceImpl.class,
+              FileLocator.locateFile("org/apache/ctakes/dictionary/lookup/fast/cTakesHsql.xml"))
+          ));
+    } catch (FileNotFoundException e) {
+      e.printStackTrace();
+      throw new ResourceInitializationException(e);
+    }
 
 		aggregateBuilder.add(LvgAnnotator.createAnnotatorDescription());
 
@@ -734,6 +764,31 @@ org.cleartk.eval.Evaluation_ImplBase<Int
 			}
 		}
 	}
+	
+  /* 
+   * The following class overrides a ClearTK utility annotator class for reading
+   * a text file into a JCas. The code is copy/pasted so that one tiny modification
+   * can be made for this corpus -- replace a single odd character (0xc) with a 
+   * space since it trips up xml output.  
+   */
+  public static class UriToDocumentTextAnnotatorCtakes extends UriToDocumentTextAnnotator {
+
+    @Override
+    public void process(JCas jCas) throws AnalysisEngineProcessException {
+      URI uri = ViewUriUtil.getURI(jCas);
+      String content;
+
+      try {
+        content = CharStreams.toString(new InputStreamReader(uri.toURL().openStream()));
+        content = content.replace((char) 0xc, ' ');
+        jCas.setSofaDataString(content, "text/plain");
+      } catch (MalformedURLException e) {
+        throw new AnalysisEngineProcessException(e);
+      } catch (IOException e) {
+        throw new AnalysisEngineProcessException(e);
+      }
+    }  
+  }
 
 	public static class WriteI2B2XML extends JCasAnnotator_ImplBase {
 		public static final String PARAM_OUTPUT_DIR="PARAM_OUTPUT_DIR";



Mime
View raw message