|
@@ -9,6 +9,8 @@ from config import config
|
|
|
|
|
|
class Markov:
|
|
|
def __init__(self):
|
|
|
+ self.counter = 0
|
|
|
+
|
|
|
self.corpus = []
|
|
|
self.chain = None
|
|
|
|
|
@@ -46,7 +48,11 @@ class Markov:
|
|
|
if len(self.corpus) > config.MARKOV_CORPUS_SIZE:
|
|
|
self.corpus = self.corpus[: config.MARKOV_CORPUS_SIZE]
|
|
|
|
|
|
- if len(self.corpus) % config.MARKOV_REBUILD_RATE == 0:
|
|
|
+ self.counter += 1
|
|
|
+
|
|
|
+ if self.counter % config.MARKOV_REBUILD_RATE == 0:
|
|
|
+ self.counter = 0
|
|
|
+
|
|
|
self.rebuild()
|
|
|
|
|
|
def load(self):
|