code: public static Parse[] collapsePunctuation(Parse[] chunks, Set punctSet) {
      List collapsedParses = new ArrayList(chunks.length);
      int lastNonPunct = -1;
      int nextNonPunct = -1;
      for (int ci=0,cn=chunks.length;ci<cn;ci++) {
        if (punctSet.contains(chunks[ci].getType())) {
          if (lastNonPunct >= 0) {
            chunks[lastNonPunct].addNextPunctuation(chunks[ci]);
          }
          for (nextNonPunct=ci+1;nextNonPunct<cn;nextNonPunct++) {
            if (!punctSet.contains(chunks[nextNonPunct].getType())) {
              break;
            }
          }
          if (nextNonPunct < cn) {
            chunks[nextNonPunct].addPreviousPunctuation(chunks[ci]);
          }
        }
        else {
          collapsedParses.add(chunks[ci]);
          lastNonPunct = ci;
        }
      }
      if (collapsedParses.size() == chunks.length) {
        return chunks;
      }
      //System.err.println("collapsedPunctuation: collapsedParses"+collapsedParses);
      return (Parse[]) collapsedParses.toArray(new Parse[collapsedParses.size()]);
    }
docs: Removes the punctuation from the specified set of chunks, adds it to the parses
  adjacent to the punctuation is specified, and returns a new array of parses with the punctuation
  removed.
  @param chunks A set of parses.
  @param punctSet The set of punctuation which is to be removed.
  @return An array of parses which is a subset of chunks with punctuation removed.