docs: def slice(self, window_size=1, step_size=1, cumulative=False,
                count_only=False, subcorpus=True, feature_name=None):
          """
          Returns a generator that yields ``(key, subcorpus)`` tuples for
          sequential time windows.
  
          Two common slicing patterns are the "sliding time-window" and the
          "time-period" patterns. Whereas time-period slicing divides the corpus
          into subcorpora by sequential non-overlapping time periods, subcorpora
          generated by time-window slicing can overlap.
  
          .. figure:: _static/images/bibliocoupling/timeline.timeslice.png
             :width: 400
             :align: center
  
             **Time-period** slicing, with a window-size of 4 years.
  
          .. figure:: _static/images/bibliocoupling/timeline.timewindow.png
             :width: 400
             :align: center
  
             **Time-window** slicing, with a window-size of 4 years and a
             step-size of 1 year.
  
          *Sliding time-window* -- Set ``step_size=1``, and ``window_size`` to
          the desired value.
          *Time-period* -- ``step_size`` and ``window_size`` should have the same
          value.
  
          The value of ``key`` is always the first year in the slice.
  
          Examples
          --------
          .. code-block:: python
  
             >>> from tethne.readers.wos import read
             >>> corpus = read('/path/to/data')
             >>> for key, subcorpus in corpus.slice():
             ...     print key, len(subcorpus)
             2005, 5
             2006, 5
  
          Parameters
          ----------
          window_size : int
              (default: 1) Size of the time window, in years.
          step_size : int
              (default: 1) Number of years to advance window at each step.
  
          Returns
          -------
          generator
          """
  
          if 'date' not in self.indices:
              self.index('date')
  
          start = min(self.indices['date'].keys())
          end = max(self.indices['date'].keys())
  
          while start <= end - (window_size - 1):
              selector = ('date', range(start, start + window_size, 1))
              if cumulative:
                  year = start + window_size
              else:
                  year = start
              if count_only:
                  yield year, len(self.select(selector))
              elif feature_name:
                  yield year, self.subfeatures(selector, feature_name)
              elif subcorpus:
                  yield year, self.subcorpus(selector)
              else:
                  yield year, self.select(selector)
              if cumulative:
                  window_size += step_size
              else:
                  start += step_size