Revision: 18950
http://sourceforge.net/p/gate/code/18950
Author: ian_roberts
Date: 2015-10-15 12:37:29 +0000 (Thu, 15 Oct 2015)
Log Message:
-----------
Edge case in RepositioningInfo when the "original" content is shorter than the
mapped "extracted" content.
Added a special case so that when we ask for the extracted offset that
corresponds to the right hand boundary of a repositioning record we always get
the right hand boundary point of the corresponding extracted segment. This
will not make a difference in most cases, but will improve accuracy when
dealing with a segment where the "original" content is shorter than its
corresponding "extracted" content. In this case, previously the extracted
offset returned would have been the start of the extracted segment plus the
length of the *original* one, whereas now it will be the start plus the length
of the extracted segment.
Modified Paths:
--------------
gate/trunk/src/main/gate/corpora/RepositioningInfo.java
Modified: gate/trunk/src/main/gate/corpora/RepositioningInfo.java
===================================================================
--- gate/trunk/src/main/gate/corpora/RepositioningInfo.java 2015-10-15
01:20:16 UTC (rev 18949)
+++ gate/trunk/src/main/gate/corpora/RepositioningInfo.java 2015-10-15
12:37:29 UTC (rev 18950)
@@ -130,8 +130,17 @@
result = -1;
}
else {
- // current position + offset in this PositionInfo record
- result = currPI.getCurrentPosition() + absPos - origPos;
+ if(absPos == origPos+origLen) {
+ // special case for boundaries - if absPos is the end boundary of
+ // this PositionInfo record (origPos+origLen) then result should
+ // always be the end boundary too (extracted pos + extracted
len).
+ // Without this check we may get the wrong position when the
"orig"
+ // length is shorter than the "extracted" length.
+ result = currPI.getCurrentPosition() + currPI.getCurrentLength();
+ } else {
+ // current position + offset in this PositionInfo record
+ result = currPI.getCurrentPosition() + absPos - origPos;
+ }
// but don't go beyond the extracted length
if(result > currPI.getCurrentPosition() +
currPI.getCurrentLength()) {
result = currPI.getCurrentPosition() + currPI.getCurrentLength();
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs