code: public static int ptb2Text(Reader ptbText, Writer w) throws IOException {
      int numTokens = 0;
      PTB2TextLexer lexer = new PTB2TextLexer(ptbText);
      for (String token; (token = lexer.next()) != null; ) {
        numTokens++;
        w.write(token);
      }
      return numTokens;
    }
docs: Writes 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.