docs: def prune_by_ngram_count(self, minimum=None, maximum=None, label=None):
          """Removes results rows whose total n-gram count (across all
          works bearing this n-gram) is outside the range specified by
          `minimum` and `maximum`.
  
          For each text, the count used as part of the sum across all
          works is the maximum count across the witnesses for that work.
  
          If `label` is specified, the works checked are restricted to
          those associated with `label`.
  
          :param minimum: minimum n-gram count
          :type minimum: `int`
          :param maximum: maximum n-gram count
          :type maximum: `int`
          :param label: optional label to restrict requirement to
          :type label: `str`
  
          """
          self._logger.info('Pruning results by n-gram count')
  
          def calculate_total(group):
              work_grouped = group.groupby(constants.WORK_FIELDNAME, sort=False)
              total_count = work_grouped[constants.COUNT_FIELDNAME].max().sum()
              group['total_count'] = pd.Series([total_count] * len(group.index),
                                               index=group.index)
              return group
  
          # self._matches may be empty, in which case not only is there
          # no point trying to do the pruning, but it will raise an
          # exception due to referencing the column 'total_count' which
          # won't have been added. Therefore just return immediately.
          if self._matches.empty:
              return
          matches = self._matches
          if label is not None:
              matches = matches[matches[constants.LABEL_FIELDNAME] == label]
          matches = matches.groupby(
              constants.NGRAM_FIELDNAME, sort=False).apply(calculate_total)
          ngrams = None
          if minimum:
              ngrams = matches[matches['total_count'] >= minimum][
                  constants.NGRAM_FIELDNAME].unique()
          if maximum:
              max_ngrams = matches[matches['total_count'] <= maximum][
                  constants.NGRAM_FIELDNAME].unique()
              if ngrams is None:
                  ngrams = max_ngrams
              else:
                  ngrams = list(set(ngrams) & set(max_ngrams))
          self._matches = self._matches[
              self._matches[constants.NGRAM_FIELDNAME].isin(ngrams)]