docs: def reduce(self):
          """Removes results rows whose n-grams are contained in larger
          n-grams."""
          self._logger.info('Reducing the n-grams')
          # This does not make use of any pandas functionality; it
          # probably could, and if so ought to.
          data = {}
          labels = {}
          # Derive a convenient data structure from the rows.
          for row_index, row in self._matches.iterrows():
              work = row[constants.WORK_FIELDNAME]
              siglum = row[constants.SIGLUM_FIELDNAME]
              labels[work] = row[constants.LABEL_FIELDNAME]
              witness_data = data.setdefault((work, siglum), {})
              witness_data[row[constants.NGRAM_FIELDNAME]] = {
                  'count': int(row[constants.COUNT_FIELDNAME]),
                  'size': int(row[constants.SIZE_FIELDNAME])}
          for witness_data in data.values():
              ngrams = list(witness_data.keys())
              ngrams.sort(key=lambda ngram: witness_data[ngram]['size'],
                          reverse=True)
              for ngram in ngrams:
                  if witness_data[ngram]['count'] > 0:
                      self._reduce_by_ngram(witness_data, ngram)
          # Recreate rows from the modified data structure.
          rows = []
          for (work, siglum), witness_data in data.items():
              for ngram, ngram_data in witness_data.items():
                  count = ngram_data['count']
                  if count > 0:
                      rows.append(
                          {constants.NGRAM_FIELDNAME: ngram,
                           constants.SIZE_FIELDNAME: ngram_data['size'],
                           constants.WORK_FIELDNAME: work,
                           constants.SIGLUM_FIELDNAME: siglum,
                           constants.COUNT_FIELDNAME: count,
                           constants.LABEL_FIELDNAME: labels[work]})
          self._matches = pd.DataFrame(
              rows, columns=constants.QUERY_FIELDNAMES)