Markov: more anti-stop bugfixes

This commit is contained in:
Brian S. Stephan 2012-09-17 16:23:42 -05:00
parent c064f6ebe1
commit 02729377d8
1 changed files with 6 additions and 2 deletions

View File

@ -429,12 +429,12 @@ class Markov(Module):
key_hits = self._retrieve_chains_for_key(self.start1, self.start2, context_id)
new_chain_words.append(self._get_suitable_word_from_choices(key_hits, gen_words, min_size))
# the database is probably empty if we got a stop from this
if gen_words[0] == self.stop:
if new_chain_words[0] == self.stop:
break
# new word 2
key_hits = self._retrieve_chains_for_key(self.start2, new_chain_words[0], context_id)
new_chain_words.append(self._get_suitable_word_from_choices(key_hits, gen_words, min_size))
if gen_words[1] != self.stop:
if new_chain_words[1] != self.stop:
# two valid words, try for a third and check for "foo:"
# new word 3 (which we may need below)
@ -447,6 +447,10 @@ class Markov(Module):
gen_words += new_chain_words[1:]
self.log.debug("appending following anti-address " \
"new_chain_words: {0:s}".format(new_chain_words[1:]))
elif new_chain_words[2] == self.stop:
gen_words += new_chain_words[0:1]
self.log.debug("appending following anti-stop " \
"new_chain_words: {0:s}".format(new_chain_words[0:1]))
else:
gen_words += new_chain_words[0:]
self.log.debug("appending following extended " \