code: private void fixDocLengths(List<List<IN>> docs) {
      final int maxDocSize = flags.maxDocSize;
  
      WordToSentenceProcessor<IN> wts = new WordToSentenceProcessor<IN>();
      List<List<IN>> newDocuments = new ArrayList<List<IN>>();
      for (List<IN> document : docs) {
        if (maxDocSize <= 0 || document.size() <= maxDocSize) {
          if (!document.isEmpty()) {
            newDocuments.add(document);
          }
          continue;
        }
        List<List<IN>> sentences = wts.process(document);
        List<IN> newDocument = new ArrayList<IN>();
        for (List<IN> sentence : sentences) {
          if (newDocument.size() + sentence.size() > maxDocSize) {
            if (!newDocument.isEmpty()) {
              newDocuments.add(newDocument);
            }
            newDocument = new ArrayList<IN>();
          }
          newDocument.addAll(sentence);
        }
        if (!newDocument.isEmpty()) {
          newDocuments.add(newDocument);
        }
      }
  
      docs.clear();
      docs.addAll(newDocuments);
    }
docs: Take a {@link List} of documents (which are themselves {@link List}s
  of something that extends {@link CoreMap}, CoreLabel by default),
  and if any are longer than the length
  specified by flags.maxDocSize split them up.  If maxDocSize is negative,
  nothing is changed.  In practice, documents need to be not too long or
  else the CRF inference will fail due to numerical problems.
  This method tries to be smart
  and split on sentence boundaries, but this is hard-coded to English.
  
  @param docs The list of documents whose length might be adjusted.