incubator-ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dlig...@apache.org
Subject svn commit: r1445677 - /incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/SystemTemporalRelationPrinter.java
Date Wed, 13 Feb 2013 15:42:02 GMT
Author: dligach
Date: Wed Feb 13 15:42:01 2013
New Revision: 1445677

URL: http://svn.apache.org/r1445677
Log:
added file names to the output

Added:
    incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/SystemTemporalRelationPrinter.java
      - copied, changed from r1445618, incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/TemporalRelationAnnotationPrinter.java

Copied: incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/SystemTemporalRelationPrinter.java
(from r1445618, incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/TemporalRelationAnnotationPrinter.java)
URL: http://svn.apache.org/viewvc/incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/SystemTemporalRelationPrinter.java?p2=incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/SystemTemporalRelationPrinter.java&p1=incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/TemporalRelationAnnotationPrinter.java&r1=1445618&r2=1445677&rev=1445677&view=diff
==============================================================================
--- incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/TemporalRelationAnnotationPrinter.java
(original)
+++ incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/SystemTemporalRelationPrinter.java
Wed Feb 13 15:42:01 2013
@@ -19,6 +19,7 @@
 package org.apache.ctakes.temporal.eval;
 
 import java.io.File;
+import java.net.URI;
 import java.util.Collection;
 import java.util.List;
 
@@ -32,6 +33,7 @@ import org.apache.uima.collection.Collec
 import org.apache.uima.jcas.JCas;
 import org.apache.uima.jcas.tcas.Annotation;
 import org.cleartk.eval.AnnotationStatistics;
+import org.cleartk.util.ViewURIUtil;
 import org.uimafit.factory.AggregateBuilder;
 import org.uimafit.factory.AnalysisEngineFactory;
 import org.uimafit.pipeline.JCasIterable;
@@ -44,9 +46,13 @@ import com.lexicalscope.jewel.cli.CliFac
  * Print temporal relations that the system adds to the CAS.
  * This is useful for conversion to an external format (e.g. for evaluation).
  * 
+ * Currently the plan is for Sameer to convert the output of this class
+ * to TimeML to run the TempEval evaluation script. Eventually, we will 
+ * switch to generating TimeML directly from this class.
+ * 
  * @author dmitriy dligach
  */
-public class TemporalRelationAnnotationPrinter extends
+public class SystemTemporalRelationPrinter extends
     EvaluationOfTemporalRelations {
 
   public static void main(String[] args) throws Exception {
@@ -56,7 +62,7 @@ public class TemporalRelationAnnotationP
     List<Integer> trainItems = THYMEData.getTrainPatientSets(patientSets);
     List<Integer> devItems = THYMEData.getDevPatientSets(patientSets);
     
-    TemporalRelationAnnotationPrinter evaluation = new TemporalRelationAnnotationPrinter(
+    SystemTemporalRelationPrinter evaluation = new SystemTemporalRelationPrinter(
         new File("target/eval/temporal-relations"),
         options.getRawTextDirectory(),
         options.getKnowtatorXMLDirectory(),
@@ -66,7 +72,7 @@ public class TemporalRelationAnnotationP
     System.err.println(stats);
   }
 
-  public TemporalRelationAnnotationPrinter(
+  public SystemTemporalRelationPrinter(
       File baseDirectory,
       File rawTextDirectory,
       File knowtatorXMLDirectory,
@@ -108,14 +114,16 @@ public class TemporalRelationAnnotationP
           systemView,
           BinaryTextRelation.class);
       
-      printRelationAnnotations(systemRelations);
+      URI uri = ViewURIUtil.getURI(jCas);
+      String[] path = uri.getPath().split("/");
+      printRelationAnnotations(path[path.length - 1], systemRelations);
       
       stats.add(goldRelations, systemRelations, getSpan, getOutcome);
     }
     return stats;
   }
 
-  private static void printRelationAnnotations(Collection<BinaryTextRelation> relations)
{
+  private static void printRelationAnnotations(String fileName, Collection<BinaryTextRelation>
relations) {
     
     for(BinaryTextRelation binaryTextRelation : relations) {
       
@@ -132,7 +140,8 @@ public class TemporalRelationAnnotationP
       
       String category = binaryTextRelation.getCategory();
 
-      System.out.format("%s\t%s\t%d\t%d\t%s\t%d\t%d\n", category, arg1Type, arg1Begin, arg1End,
arg2Type, arg2Begin, arg2End);
+      System.out.format("%s\t%s\t%s\t%d\t%d\t%s\t%d\t%d\n", 
+          fileName, category, arg1Type, arg1Begin, arg1End, arg2Type, arg2Begin, arg2End);
     }
   }
 }



Mime
View raw message