code: def generate(self, state, size, dataset, backward=False):
          
          if isinstance(state, str):
              state = self.split_state(state)
          state = self.get_state(state, size)
          dataset = self.get_dataset(dataset)
          while True:
              link, state = self.random_link(dataset, state, backward)
              if link is None or backward and link == '':
                  return
              yield link
docs: Generate a sequence.
  
          Parameters
          ----------
          state : `str` or `iterable` of `str`
              Initial state.
          size : `int`
              State size.
          dataset : `str`
              Dataset key.
          backward : `bool`, optional
              Link direction.
  
          Returns
          -------
          `generator` of `str`
              Node value generator.