code: private static <PS, SEG, S> ToSemigroup<Paragraph<PS, SEG, S>, Summary> summaryProvider() {
          return new ToSemigroup<Paragraph<PS, SEG, S>, Summary>() {
  
              @Override
              public Summary apply(Paragraph<PS, SEG, S> p) {
                  return new Summary(1, p.length());
              }
  
              @Override
              public Summary reduce(Summary left, Summary right) {
                  return new Summary(
                          left.paragraphCount + right.paragraphCount,
                          left.charCount + right.charCount);
              }
          };
  
      }
docs: Private method for quickly calculating the length of a portion (subdocument) of this document.