Revision: 18447
          http://sourceforge.net/p/gate/code/18447
Author:   ian_roberts
Date:     2014-11-08 15:19:27 +0000 (Sat, 08 Nov 2014)
Log Message:
-----------
Extend the last repositioning record by 1 character so we don't get -1 position 
for annotations that cover the last character of the tweet.

Modified Paths:
--------------
    gate/trunk/src/main/gate/corpora/DocumentJsonUtils.java

Modified: gate/trunk/src/main/gate/corpora/DocumentJsonUtils.java
===================================================================
--- gate/trunk/src/main/gate/corpora/DocumentJsonUtils.java     2014-11-08 
13:54:23 UTC (rev 18446)
+++ gate/trunk/src/main/gate/corpora/DocumentJsonUtils.java     2014-11-08 
15:19:27 UTC (rev 18447)
@@ -322,8 +322,8 @@
         // indices:[start, end], corrected to match the sub-range of
         // text we're writing
         json.writeArrayFieldStart("indices");
-        json.writeNumber(repos.getOriginalPos(a.getStartNode().getOffset() - 
start));
-        json.writeNumber(repos.getOriginalPos(a.getEndNode().getOffset() - 
start));
+        json.writeNumber(repos.getOriginalPos(a.getStartNode().getOffset() - 
start, true));
+        json.writeNumber(repos.getOriginalPos(a.getEndNode().getOffset() - 
start, false));
         json.writeEndArray(); // end of indices
         if(annotationTypeProperty != null) {
           json.writeStringField(annotationTypeProperty, a.getType());
@@ -416,7 +416,7 @@
     int tailLen = str.length() - lastMatchEnd;
     if(tailLen > 0) {
       // repositioning record covering everything after the last match
-      repos.addPositionInfo(lastMatchEnd + correction, tailLen, lastMatchEnd, 
tailLen);
+      repos.addPositionInfo(lastMatchEnd + correction, tailLen + 1, 
lastMatchEnd, tailLen + 1);
     }
     mat.appendTail(buf);
     return buf.toString();

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
_______________________________________________
GATE-cvs mailing list
GATE-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to