txlyre 6 月之前
父节点
当前提交
291a181838
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      markov.py

+ 2 - 2
markov.py

@@ -32,6 +32,8 @@ class Markov:
     def rebuild(self):
         self.chain = markovify.Chain(self.corpus, config.MARKOV_STATE_SIZE).compile()
 
+        self.counter = 0
+
     def extend_corpus(self, text):
         text = text.strip()
         if not text:
@@ -51,8 +53,6 @@ class Markov:
         self.counter += 1
 
         if self.counter % config.MARKOV_REBUILD_RATE == 0:
-            self.counter = 0
-
             self.rebuild()
 
     def load(self):