code: def precompute_begin_state(self):
          
          begin_state = tuple([ BEGIN ] * self.state_size)
          choices, weights = zip(*self.model[begin_state].items())
          cumdist = list(accumulate(weights))
          self.begin_cumdist = cumdist
          self.begin_choices = choices
docs: Caches the summation calculation and available choices for BEGIN * state_size.
          Significantly speeds up chain generation on large corpuses. Thanks, @schollz!