Markov: keep start2 from leaking out of backfill

only add the reverse-search result to list of words if it isn't __start2
(and if it is __start2, just carry on, giving the code one last chance
to find something else)
This commit is contained in:
Brian S. Stephan 2013-02-08 02:02:44 -06:00
parent 5a55227cf9
commit db221a3c06
1 changed files with 4 additions and 1 deletions

View File

@ -378,7 +378,10 @@ class Markov(Module):
back_k2 = self._retrieve_random_k2_for_value(seed_word, context_id)
if back_k2:
found_word = seed_word
working_backwards.append(back_k2)
if back_k2 == self.start2:
self.log.debug("random further back was start2, swallowing")
else:
working_backwards.append(back_k2)
working_backwards.append(found_word)
self.log.debug("started working backwards with: {0:s}".format(found_word))
self.log.debug("working_backwards: {0:s}".format(" ".join(working_backwards)))