komalsahedani / cleartk

Automatically exported from code.google.com/p/cleartk
0 stars 0 forks source link

Following() and Preceding() throw Exception when used with start index outside the text boundaries #330

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When I select a start index that is outside the text boundaries, instead of 
adding out of bounds values (OOBs), it throws an exception.

Can be reproduced using the the "CleartkExtractorTest" basicTest method.
E.g. by using
         new Preceding(5, 6),
 or
         new Following(5, 6));
 in

     CleartkExtractor extractor = new CleartkExtractor(
         Token.class,
         new CoveredTextExtractor(),
         new Preceding(2),
         new Preceding(3, 6),
         new Covered(),
         new FirstCovered(1),
         new FirstCovered(1, 3),
         new LastCovered(1),
         new LastCovered(1, 3),
         new Following(1, 3),
         new Following(3, 5));

Exception:
 java.lang.IllegalArgumentException: fromIndex(5) > toIndex(4)
     at java.util.SubList.<init>(AbstractList.java:604)
     at java.util.AbstractList.subList(AbstractList.java:468)
     at org.cleartk.classifier.feature.extractor.CleartkExtractor$LeftToRightContext.extract(CleartkExtractor.java:374)
     at
 org.cleartk.classifier.feature.extractor.CleartkExtractor$Following.extract(CleartkExtractor.java:1)
     at
 org.cleartk.classifier.feature.extractor.CleartkExtractor.extract(CleartkExtracto.java:128)
     at
 org.cleartk.classifier.feature.extractor.CleartkExtractor.extract(CleartkExtractor.java:92)
     at
 org.cleartk.classifier.feature.extractor.CleartkExtractorTest.testBasic2(CleartkExtractorTest.java:131)

Original issue reported on code.google.com by torsten....@gmail.com on 16 Aug 2012 at 2:58

GoogleCodeExporter commented 9 years ago

Original comment by steven.b...@gmail.com on 28 Mar 2013 at 1:34

GoogleCodeExporter commented 9 years ago
This issue was closed by revision b546a3638a0b.

Original comment by steven.b...@gmail.com on 29 Mar 2013 at 12:34