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) | ||||
| 
 | ||||
|         # load the existing chain starts from the database | ||||
|         self.starts = self._get_chain_beginnings() | ||||
| 
 | ||||
|     def db_init(self): | ||||
|         """Create the markov chain table.""" | ||||
| 
 | ||||
| @ -239,8 +236,6 @@ class Markov(Module): | ||||
|         if len(words) <= 0: | ||||
|             return line | ||||
| 
 | ||||
|         self.starts.append(words[0]) | ||||
| 
 | ||||
|         try: | ||||
|             db = self.get_db() | ||||
|             cur = db.cursor() | ||||
| @ -277,7 +272,7 @@ class Markov(Module): | ||||
|             raise Exception("min_size is too large: %d" % min_size) | ||||
| 
 | ||||
|         # 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 | ||||
|         min_search_tries = 0 | ||||
| @ -328,7 +323,7 @@ class Markov(Module): | ||||
|         target_word = words[random.randint(0, len(words)-1)] | ||||
| 
 | ||||
|         # 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 | ||||
|         while len(gen_words) < max_size + 2 and gen_words[-1] != self.stop: | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user