public static String ptb2Text(String ptbText){
  StringBuffer sb=new StringBuffer(ptbText.length());
  PTB2TextLexer lexer=new PTB2TextLexer(new StringReader(ptbText));
  String token;
  try {
    while ((token=lexer.next()) != null)     sb.append(token);
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  return (sb.toString());
}

public static String ptb2Text ( String ptbText ) { StringBuffer sb = new StringBuffer ( ptbText . length ( ) ) ; PTB2TextLexer lexer = new PTB2TextLexer ( new StringReader ( ptbText ) ) ; String token ; try { while ( ( token = lexer . next ( ) ) != null ) sb . append ( token ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return ( sb . toString ( ) ) ; }
returns a presentable version of the given ptb - tokenized text . ptb tokenization splits up punctuation and does various other things that makes simply joining the tokens with spaces look bad . so join the tokens with space and run it through this method to produce nice looking text . it ' s not perfect , but it works pretty well .
