@@ -225,14 +225,14 @@ private ArrayList<Pair<CoreLabel, String>> splitToken(Pair<CoreLabel, String> to
225
225
// if token is not the last one, add class C
226
226
if (backwardsPartsIterator .hasPrevious ()){
227
227
int partLength = part .length ();
228
- partToken = factory .makeToken (part , token .originalText (), tokenEndPosition -partLength , partLength );
228
+ partToken = factory .makeToken (part , token .originalText (), tokenEndPosition -partLength , partLength + 1 );
229
229
tokenEndPosition = tokenEndPosition -partLength ;
230
230
partTokenAndClass = new Pair <CoreLabel ,String >(partToken , "C" );
231
231
}
232
232
// if last token (first part), add original class (S or T)
233
233
else {
234
234
int partLength = part .length ();
235
- partToken = factory .makeToken (part , token .originalText (), tokenBeginPosition , partLength );
235
+ partToken = factory .makeToken (part , token .originalText (), tokenBeginPosition , partLength + 1 );
236
236
partTokenAndClass = new Pair <CoreLabel , String >(partToken , originalClass );
237
237
}
238
238
splittedTokenAndClass .add (0 , partTokenAndClass );
@@ -388,7 +388,7 @@ public List<List<CoreLabel>> tokenize(String text){
388
388
//If there hasn't been O class between tokens, create token for last word
389
389
if (currentWord != "" ){
390
390
endToken = i -1 ;
391
- CoreLabel newToken = factory .makeToken (currentWord , currentWord , beginToken , endToken -beginToken );
391
+ CoreLabel newToken = factory .makeToken (currentWord , currentWord , beginToken , endToken -beginToken + 1 );
392
392
Pair <CoreLabel , String > tokenAndClass = new Pair <CoreLabel , String >(newToken ,lastBeginChar );
393
393
sentenceTokensBase .add (tokenAndClass );
394
394
tokensCounter ++;
@@ -412,7 +412,7 @@ public List<List<CoreLabel>> tokenize(String text){
412
412
//If there hasn't been O class between tokens, create token for last word
413
413
if (currentWord != "" ){
414
414
endToken = i -1 ;
415
- CoreLabel newToken = factory .makeToken (currentWord , currentWord , beginToken , endToken -beginToken );
415
+ CoreLabel newToken = factory .makeToken (currentWord , currentWord , beginToken , endToken -beginToken + 1 );
416
416
Pair <CoreLabel , String > tokenAndClass = new Pair <CoreLabel , String >(newToken ,lastBeginChar );
417
417
sentenceTokensBase .add (tokenAndClass );
418
418
tokensCounter ++;
@@ -437,7 +437,7 @@ public List<List<CoreLabel>> tokenize(String text){
437
437
if (currentClass .equals ("O" )){
438
438
endToken = i -1 ;
439
439
//Create new token with previous character, add it with its class to list, increment token counter
440
- CoreLabel newToken = factory .makeToken (currentWord , currentWord , beginToken , endToken -beginToken );
440
+ CoreLabel newToken = factory .makeToken (currentWord , currentWord , beginToken , endToken -beginToken + 1 );
441
441
Pair <CoreLabel , String > tokenAndClass = new Pair <CoreLabel , String >(newToken ,lastBeginChar );
442
442
sentenceTokensBase .add (tokenAndClass );
443
443
tokensCounter ++;
@@ -449,7 +449,7 @@ public List<List<CoreLabel>> tokenize(String text){
449
449
//End of text
450
450
if (i ==(classificationResults .size ()-1 )) {
451
451
endToken = i -1 ;
452
- CoreLabel newToken = factory .makeToken (currentWord , currentWord , beginToken , endToken -beginToken );
452
+ CoreLabel newToken = factory .makeToken (currentWord , currentWord , beginToken , endToken -beginToken + 1 );
453
453
Pair <CoreLabel , String > tokenAndClass = new Pair <CoreLabel , String >(newToken ,lastBeginChar );
454
454
sentenceTokensBase .add (tokenAndClass );
455
455
tokensCounter ++;
0 commit comments