@@ -437,9 +437,16 @@ public CoreLabel convertLineToCoreLabel(CoNLLUSentence sentence, String line) {
437
437
cl .setIsMWT (false );
438
438
cl .setIsMWTFirst (false );
439
439
} else if (sentence .mwtData .containsKey (sentenceTokenIndex - 1 )) {
440
+ String miscInfo = sentence .mwtMiscs .get (sentence .mwtData .get (sentenceTokenIndex - 1 ));
441
+ Map <String , String > mwtKeyValues = new HashMap <>();
442
+ if (miscInfo != null && !miscInfo .equals ("_" )) {
443
+ Arrays .stream (miscInfo .split ("\\ |" )).forEach (
444
+ kv -> mwtKeyValues .put (kv .split ("=" , 2 )[0 ], kv .split ("=" )[1 ]));
445
+ }
446
+
440
447
// set MWT text
441
448
cl .set (CoreAnnotations .MWTTokenTextAnnotation .class ,
442
- sentence .mwtTokens .get (sentence .mwtData .get (sentenceTokenIndex - 1 )));
449
+ sentence .mwtTokens .get (sentence .mwtData .get (sentenceTokenIndex - 1 )));
443
450
cl .setIsMWT (true );
444
451
// check if first
445
452
if (sentence .mwtData .containsKey (sentenceTokenIndex - 2 ) &&
@@ -457,16 +464,8 @@ public CoreLabel convertLineToCoreLabel(CoNLLUSentence sentence, String line) {
457
464
// then we aren't last, and SpaceAfter="" is implicitly true
458
465
cl .setAfter ("" );
459
466
} else {
460
- String miscInfo = sentence .mwtMiscs .get (sentence .mwtData .get (sentenceTokenIndex - 1 ));
461
- if (miscInfo != null && !miscInfo .equals ("_" )) {
462
- Map <String , String > mwtKeyValues = new HashMap <>();
463
- Arrays .stream (miscInfo .split ("\\ |" )).forEach (
464
- kv -> mwtKeyValues .put (kv .split ("=" , 2 )[0 ], kv .split ("=" )[1 ]));
465
- String spaceAfter = miscToSpaceAfter (mwtKeyValues );
466
- cl .setAfter (spaceAfter );
467
- } else {
468
- cl .setAfter (" " );
469
- }
467
+ String spaceAfter = miscToSpaceAfter (mwtKeyValues );
468
+ cl .setAfter (spaceAfter );
470
469
}
471
470
} else {
472
471
cl .setIsMWT (false );
0 commit comments