docs: 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);
    }