Markov: remove the 'starts' dictionary
This commit is contained in:
parent
116251398e
commit
7f922dd2c9
@ -59,9 +59,6 @@ class Markov(Module):
|
|||||||
|
|
||||||
Module.__init__(self, irc, config, server)
|
Module.__init__(self, irc, config, server)
|
||||||
|
|
||||||
# load the existing chain starts from the database
|
|
||||||
self.starts = self._get_chain_beginnings()
|
|
||||||
|
|
||||||
def db_init(self):
|
def db_init(self):
|
||||||
"""Create the markov chain table."""
|
"""Create the markov chain table."""
|
||||||
|
|
||||||
@ -239,8 +236,6 @@ class Markov(Module):
|
|||||||
if len(words) <= 0:
|
if len(words) <= 0:
|
||||||
return line
|
return line
|
||||||
|
|
||||||
self.starts.append(words[0])
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
db = self.get_db()
|
db = self.get_db()
|
||||||
cur = db.cursor()
|
cur = db.cursor()
|
||||||
@ -277,7 +272,7 @@ class Markov(Module):
|
|||||||
raise Exception("min_size is too large: %d" % min_size)
|
raise Exception("min_size is too large: %d" % min_size)
|
||||||
|
|
||||||
# start with an empty chain, and work from there
|
# start with an empty chain, and work from there
|
||||||
gen_words = [self.start1, self.start2, random.choice(self.starts)]
|
gen_words = [self.start1, self.start2]
|
||||||
|
|
||||||
# set up the number of times we've tried to hit the specified minimum
|
# set up the number of times we've tried to hit the specified minimum
|
||||||
min_search_tries = 0
|
min_search_tries = 0
|
||||||
@ -328,7 +323,7 @@ class Markov(Module):
|
|||||||
target_word = words[random.randint(0, len(words)-1)]
|
target_word = words[random.randint(0, len(words)-1)]
|
||||||
|
|
||||||
# start with an empty chain, and work from there
|
# start with an empty chain, and work from there
|
||||||
gen_words = [self.start1, self.start2, random.choice(self.starts)]
|
gen_words = [self.start1, self.start2]
|
||||||
|
|
||||||
# walk a chain, randomly, building the list of words
|
# walk a chain, randomly, building the list of words
|
||||||
while len(gen_words) < max_size + 2 and gen_words[-1] != self.stop:
|
while len(gen_words) < max_size + 2 and gen_words[-1] != self.stop:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user