private void deEndify ( List < CoreLabel > tokens ) { if ( flags . retainEntitySubclassification ) { return ; } tokens = new PaddedList < CoreLabel > ( tokens , new CoreLabel ( ) ) ; int k = tokens . size ( ) ; String [ ] newAnswers = new String [ k ] ; for ( int i = 0 ; i < k ; i ++ ) { CoreLabel c = tokens . get ( i ) ; CoreLabel p = tokens . get ( i - 1 ) ; if ( c . get ( AnswerAnnotation . class ) . length ( ) > 1 && c . get ( AnswerAnnotation . class ) . charAt ( 1 ) == ' ' ) { String base = c . get ( AnswerAnnotation . class ) . substring ( 2 ) ; String pBase = ( p . get ( AnswerAnnotation . class ) . length ( ) <= 2 ? p . get ( AnswerAnnotation . class ) : p . get ( AnswerAnnotation . class ) . substring ( 2 ) ) ; boolean isSecond = ( base . equals ( pBase ) ) ; boolean isStart = ( c . get ( AnswerAnnotation . class ) . charAt ( 0 ) == ' ' || c . get ( AnswerAnnotation . class ) . charAt ( 0 ) == ' ' ) ; if ( isSecond && isStart ) { newAnswers [ i ] = intern ( "B-" + base ) ; } else { newAnswers [ i ] = intern ( "I-" + base ) ; } } else { newAnswers [ i ] = c . get ( AnswerAnnotation . class ) ; } } for ( int i = 0 ; i < k ; i ++ ) { CoreLabel c = tokens . get ( i ) ; c . set ( AnswerAnnotation . class , newAnswers [ i ] ) ; } }
Return the coding scheme to IOB1 coding regardless of what was used internally . This is useful for scoring against CoNLL test output .