markovify
markovify copied to clipboard
markov_text_model.make_sentence_with_start KeyError
KeyError Traceback (most recent call last)
4 frames /content/tegridy-tools/tegridy-tools/markovify.py in make_sentence_with_start(self, beginning, strict, **kwargs) 516 517 for init_state in init_states: --> 518 output = self.make_sentence(init_state, **kwargs) 519 if output is not None: 520 return output
/content/tegridy-tools/tegridy-tools/markovify.py in make_sentence(self, init_state, **kwargs) 460 461 for _ in range(tries): --> 462 words = prefix + self.chain.walk(init_state) 463 if (max_words != None and len(words) > max_words) or (min_words != None and len(words) < min_words): 464 continue # pragma: no cover # see https://github.com/nedbat/coveragepy/issues/198
/content/tegridy-tools/tegridy-tools/markovify.py in walk(self, init_state) 166 (as a tuple). 167 """ --> 168 return list(self.gen(init_state)) 169 170 def to_json(self):
/content/tegridy-tools/tegridy-tools/markovify.py in gen(self, init_state) 155 state = init_state or (BEGIN,) * self.state_size 156 while True: --> 157 next_word = self.move(state) 158 if next_word == END: break 159 yield next_word
/content/tegridy-tools/tegridy-tools/markovify.py in move(self, state) 135 """ 136 if self.compiled: --> 137 choices, cumdist = self.model[state] 138 elif state == tuple([ BEGIN ] * self.state_size): 139 choices = self.begin_choices
KeyError: ('_BEGIN', '田疭畩', '疭疭畩'