Markov: trivial code cleanup
This commit is contained in:
parent
14fd5721c1
commit
b327bcab71
|
@ -288,7 +288,7 @@ class Markov(Module):
|
||||||
# don't learn recursion
|
# don't learn recursion
|
||||||
if not event._recursing:
|
if not event._recursing:
|
||||||
words = line.split()
|
words = line.split()
|
||||||
if len(words) <= 0:
|
if len(words) == 0:
|
||||||
return line
|
return line
|
||||||
|
|
||||||
db = self.get_db()
|
db = self.get_db()
|
||||||
|
@ -465,7 +465,7 @@ class Markov(Module):
|
||||||
if len(gen_words) < min_size + 2 and len(filter(lambda a: a != self.stop, key_hits)) > 0:
|
if len(gen_words) < min_size + 2 and len(filter(lambda a: a != self.stop, key_hits)) > 0:
|
||||||
found_word = random.choice(filter(lambda a: a != self.stop, key_hits))
|
found_word = random.choice(filter(lambda a: a != self.stop, key_hits))
|
||||||
return found_word
|
return found_word
|
||||||
elif len(key_hits) <= 0:
|
elif len(key_hits) == 0:
|
||||||
return self.stop
|
return self.stop
|
||||||
else:
|
else:
|
||||||
found_word = random.choice(key_hits)
|
found_word = random.choice(key_hits)
|
||||||
|
|
Loading…
Reference in New Issue