code: def feature_distribution(self, featureset_name, feature, mode='counts',
                               **slice_kwargs):
          
  
          values = []
          keys = []
          fset = self.features[featureset_name]
  
          for key, papers in self.slice(subcorpus=False, **slice_kwargs):
              allfeatures = [v for v
                             in chain(*[fset.features[self._generate_index(p)]
                                        for p in papers
                                        if self._generate_index(p)
                                        in fset.features])]
  
              if len(allfeatures) < 1:
                  keys.append(key)
                  values.append(0.)
                  continue
  
              count = 0.
              for elem, v in allfeatures:
                  if elem != feature:
                      continue
                  if mode == 'counts':
                      count += v
                  else:
                      count += 1.
              values.append(count)
              keys.append(key)
          return keys, values
docs: Calculates the distribution of a feature across slices of the corpus.
  
          Examples
          --------
          .. code-block:: python
  
             >>> corpus.feature_distribution(featureset_name='citations', \
             ...                             feature='DOLE RJ 1965 CELL', \
             ...                             step_size=1, window_size=1)
             [2, 15, 25, 1]
  
          Parameters
          ----------
          featureset_name : str
              Name of a :class:`.FeatureSet` in the :class:`.Corpus`\.
          feature : str
              Name of the specific feature of interest. E.g. if
              ``featureset_name='citations'``, then ``feature`` could be
              something like ``'DOLE RJ 1965 CELL'``.
          mode : str
              (default: ``'counts'``) If set to ``'counts'``, values will be the
              sum of all count values for the feature in each slice. If set to
              ``'documentCounts'``, values will be the number of papers in which
              the feature occurs in each slice.
          slice_kwargs : kwargs
              Keyword arguments to be passed to :meth:`.Corpus.slice`\.
  
          Returns
          -------
          list