Exemplo n.º 1
0
 /**
  * Terms counter.
  *
  * @param termSpec the term spec
  * @return the counter
  */
 default Counter<String> terms(@NonNull TermSpec termSpec) {
   return termSpec
       .getValueCalculator()
       .adjust(
           new HashMapCounter<>(
               stream()
                   .flatMap(
                       doc ->
                           doc.get(termSpec.getAnnotationType())
                               .stream()
                               .filter(termSpec.getFilter())
                               .map(termSpec.getToStringFunction())
                               .collect(Collectors.toList()))
                   .countByValue()));
 }
Exemplo n.º 2
0
 /**
  * Terms counter.
  *
  * @return the counter
  */
 default Counter<String> terms() {
   return terms(TermSpec.create());
 }