You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ctakes.apache.org by se...@apache.org on 2022/09/14 16:30:39 UTC

svn commit: r1904077 - /ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/cc/SemanticTableFileWriter.java

Author: seanfinan
Date: Wed Sep 14 16:30:38 2022
New Revision: 1904077

URL: http://svn.apache.org/viewvc?rev=1904077&view=rev
Log:
Adding annotation span to the table

Modified:
    ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/cc/SemanticTableFileWriter.java

Modified: ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/cc/SemanticTableFileWriter.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/cc/SemanticTableFileWriter.java?rev=1904077&r1=1904076&r2=1904077&view=diff
==============================================================================
--- ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/cc/SemanticTableFileWriter.java (original)
+++ ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/cc/SemanticTableFileWriter.java Wed Sep 14 16:30:38 2022
@@ -43,6 +43,7 @@ public class SemanticTableFileWriter ext
             " Semantic Group ",
             " Semantic Type ",
             " Section ",
+            " Span ",
             " Negated ",
             " Uncertain ",
             " Generic ",
@@ -75,7 +76,10 @@ public class SemanticTableFileWriter ext
          }
       }
       return infos.stream()
-                  .sorted( Comparator.comparing( AnnotationInfo::getGroup )
+//                  .sorted( Comparator.comparing( AnnotationInfo::getGroup )
+                  .sorted( Comparator.comparingInt( AnnotationInfo::getBegin )
+                                     .thenComparingInt( AnnotationInfo::getEnd )
+                                     .thenComparing( AnnotationInfo::getGroup )
                                      .thenComparing( AnnotationInfo::getTui )
                                      .thenComparing( AnnotationInfo::getSection )
                                      .thenComparing( AnnotationInfo::isNegated )
@@ -95,6 +99,8 @@ public class SemanticTableFileWriter ext
    static private class AnnotationInfo {
 
       private final String _group;
+      private final int _begin;
+      private final int _end;
       private final String _tui;
       private final String _section;
       private final String _cui;
@@ -108,6 +114,8 @@ public class SemanticTableFileWriter ext
                               final IdentifiedAnnotation annotation ) {
          _group = tui.getGroup()
                      .getName();
+         _begin = annotation.getBegin();
+         _end = annotation.getEnd();
          _tui = tui.getSemanticType();
          final String sectionText = ( section == null || section.isEmpty() )
                                     ? "NULL"
@@ -135,6 +143,7 @@ public class SemanticTableFileWriter ext
                getGroup(),
                getTui(),
                getSection(),
+               getBegin() + "," + getEnd(),
                isNegated() + "",
                isUncertain() + "",
                isGeneric() + "",
@@ -155,6 +164,14 @@ public class SemanticTableFileWriter ext
          return _section;
       }
 
+      public int getBegin() {
+         return _begin;
+      }
+
+      public int getEnd() {
+         return _end;
+      }
+
       public String getCui() {
          return _cui;
       }