You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ctakes.apache.org by st...@apache.org on 2013/07/09 20:21:14 UTC

svn commit: r1501422 - /ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/PrintInconsistentAnnotations.java

Author: stevenbethard
Date: Tue Jul  9 18:21:13 2013
New Revision: 1501422

URL: http://svn.apache.org/r1501422
Log:
Sorts events by begin offset before printing them

Modified:
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/PrintInconsistentAnnotations.java

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/PrintInconsistentAnnotations.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/PrintInconsistentAnnotations.java?rev=1501422&r1=1501421&r2=1501422&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/PrintInconsistentAnnotations.java (original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/PrintInconsistentAnnotations.java Tue Jul  9 18:21:13 2013
@@ -4,6 +4,8 @@ import java.io.File;
 import java.util.Collections;
 import java.util.List;
 
+import javax.annotation.Nullable;
+
 import org.apache.ctakes.temporal.eval.CommandLine;
 import org.apache.ctakes.temporal.eval.Evaluation_ImplBase.XMIReader;
 import org.apache.ctakes.temporal.eval.THYMEData;
@@ -20,9 +22,11 @@ import org.uimafit.factory.AnalysisEngin
 import org.uimafit.pipeline.JCasIterable;
 import org.uimafit.util.JCasUtil;
 
+import com.google.common.base.Function;
 import com.google.common.collect.HashMultimap;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Multimap;
+import com.google.common.collect.Ordering;
 import com.lexicalscope.jewel.cli.CliFactory;
 import com.lexicalscope.jewel.cli.Option;
 
@@ -114,7 +118,14 @@ public class PrintInconsistentAnnotation
           } else {
             System.err.printf("Container: \"%s\"\n", container.getCoveredText());
           }
-          for (EventMention event : containers.get(container)) {
+          Ordering<EventMention> byBegin =
+              Ordering.natural().onResultOf(new Function<EventMention, Integer>() {
+                @Override
+                public Integer apply(@Nullable EventMention event) {
+                  return event.getBegin();
+                }
+              });
+          for (EventMention event : byBegin.sortedCopy(containers.get(container))) {
             System.err.printf(
                 "* \"%s\" (docTimeRel=%s)\n",
                 event.getCoveredText(),