From 0b6d5e3f449f9cdf1514a3e17c5b4bd7e01e8486 Mon Sep 17 00:00:00 2001 From: "Brian S. Stephan" Date: Fri, 8 Feb 2013 02:11:29 -0600 Subject: [PATCH] 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 --- modules/Markov.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/Markov.py b/modules/Markov.py index b2f9125..886d612 100644 --- a/modules/Markov.py +++ b/modules/Markov.py @@ -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:]