public static List<CoreLabel> toCharacterSequence(Sequence<IString> tokenSequence){
  List<CoreLabel> charSequence=new ArrayList<>(tokenSequence.size() * 7);
  for (  IString token : tokenSequence) {
    String tokenStr=token.toString();
    if (charSequence.size() > 0) {
      CoreLabel charLabel=new CoreLabel();
      charLabel.set(CoreAnnotations.TextAnnotation.class,WHITESPACE);
      charLabel.set(CoreAnnotations.CharAnnotation.class,WHITESPACE);
      charLabel.set(CoreAnnotations.ParentAnnotation.class,WHITESPACE);
      charLabel.set(CoreAnnotations.CharacterOffsetBeginAnnotation.class,-1);
      charLabel.setIndex(charSequence.size());
      charSequence.add(charLabel);
    }
    for (int j=0, size=tokenStr.length(); j < size; ++j) {
      CoreLabel charLabel=new CoreLabel();
      String ch=String.valueOf(tokenStr.charAt(j));
      charLabel.set(CoreAnnotations.TextAnnotation.class,ch);
      charLabel.set(CoreAnnotations.CharAnnotation.class,ch);
      charLabel.set(CoreAnnotations.ParentAnnotation.class,tokenStr);
      charLabel.set(CoreAnnotations.CharacterOffsetBeginAnnotation.class,j);
      charLabel.setIndex(charSequence.size());
      charSequence.add(charLabel);
    }
  }
  return charSequence;
}

public static List < CoreLabel > toCharacterSequence ( Sequence < IString > tokenSequence ) { List < CoreLabel > charSequence = new ArrayList < > ( tokenSequence . size ( ) * 7 ) ; for ( IString token : tokenSequence ) { String tokenStr = token . toString ( ) ; if ( charSequence . size ( ) > 0 ) { CoreLabel charLabel = new CoreLabel ( ) ; charLabel . set ( CoreAnnotations . TextAnnotation . class , WHITESPACE ) ; charLabel . set ( CoreAnnotations . CharAnnotation . class , WHITESPACE ) ; charLabel . set ( CoreAnnotations . ParentAnnotation . class , WHITESPACE ) ; charLabel . set ( CoreAnnotations . CharacterOffsetBeginAnnotation . class , - 1 ) ; charLabel . setIndex ( charSequence . size ( ) ) ; charSequence . add ( charLabel ) ; } for ( int j = 0 , size = tokenStr . length ( ) ; j < size ; ++ j ) { CoreLabel charLabel = new CoreLabel ( ) ; String ch = String . valueOf ( tokenStr . charAt ( j ) ) ; charLabel . set ( CoreAnnotations . TextAnnotation . class , ch ) ; charLabel . set ( CoreAnnotations . CharAnnotation . class , ch ) ; charLabel . set ( CoreAnnotations . ParentAnnotation . class , tokenStr ) ; charLabel . set ( CoreAnnotations . CharacterOffsetBeginAnnotation . class , j ) ; charLabel . setIndex ( charSequence . size ( ) ) ; charSequence . add ( charLabel ) ; } } return charSequence ; }
convert a tokenized sequence to a character string .
