Markov: always update hit_word

whether or not we went backwards and forwards, or just forwards, this
cycle of the loop, end the iteration by calling the end of the sentence
our hit word. if it was our seed word, this will trigger a new seed
selection
This commit is contained in:
Brian S. Stephan 2013-02-08 02:11:29 -06:00
parent e7bed15ee8
commit 0b6d5e3f44
1 changed files with 4 additions and 1 deletions

View File

@ -410,7 +410,6 @@ class Markov(Module):
self.log.debug("gen_words: {0:s}".format(" ".join(gen_words)))
break
hit_word = seed_word
else:
# work forwards
self.log.debug("looking forwards")
@ -482,6 +481,10 @@ class Markov(Module):
self.log.debug("appending following short new_chain_words: {0:s}".format(new_chain_words))
gen_words += new_chain_words
# no matter forwards or backwards, use the end of the sentence
# as our current hit word
hit_word = gen_words[-1]
# chop off the seed data at the start
gen_words = gen_words[2:]