Revision: 17316
http://sourceforge.net/p/gate/code/17316
Author: valyt
Date: 2014-02-15 18:39:47 +0000 (Sat, 15 Feb 2014)
Log Message:
-----------
Fixed a few edge cases (zero-length tags at the start / end of the document).
Modified Paths:
--------------
mimir/trunk/mimir-core/src/gate/mimir/index/OriginalMarkupMetadataHelper.java
Modified:
mimir/trunk/mimir-core/src/gate/mimir/index/OriginalMarkupMetadataHelper.java
===================================================================
---
mimir/trunk/mimir-core/src/gate/mimir/index/OriginalMarkupMetadataHelper.java
2014-02-15 18:24:36 UTC (rev 17315)
+++
mimir/trunk/mimir-core/src/gate/mimir/index/OriginalMarkupMetadataHelper.java
2014-02-15 18:39:47 UTC (rev 17316)
@@ -194,6 +194,15 @@
if(tokens.length <= nonTokens.length){
output.append(nonTokens[tokens.length - 1]);
}
+ // any remaining tags, are zero-length, after the last token
+ while(currentTag != null) {
+ String openingTag = docTags.tagDescriptors.get(currentTag[0]);
+ output.append(openingTag);
+ output.append(getClosingTag(openingTag));
+ // consume the tag
+ currentTag = (tagIter != null && tagIter.hasNext()) ?
+ tagIter.next() : null;
+ }
}
/* (non-Javadoc)
@@ -274,11 +283,11 @@
}
while(currentTag != null){
- //we did not exhaust all tags, we'll assign all remaining tags to the
last
- //token
- int tokIdx = tokens.length -1;
+ // we did not exhaust all tags, we'll assign all remaining tags as
+ // zero-length tags after the last token
+ int tokIdx = tokens.length;
int tagDescId = getTagId(currentTag, documentTags);
- documentTags.tags.add(new int[]{tagDescId, tokIdx, tokIdx + 1});
+ documentTags.tags.add(new int[]{tagDescId, tokIdx, tokIdx});
//update the current tag
currentTag = tagsiter.hasNext() ? tagsiter.next() : null;
tagStart = currentTag == null ? -1 :
currentTag.getStartNode().getOffset();
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Android apps run on BlackBerry 10
Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
Now with support for Jelly Bean, Bluetooth, Mapview and more.
Get your Android app in front of a whole new audience. Start now.
http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs