txlyre 1 week ago
parent
commit
a70d963aad
1 changed files with 3 additions and 0 deletions
  1. 3 0
      markov.py

+ 3 - 0
markov.py

@@ -35,6 +35,9 @@ class Markov:
         if not words:
         if not words:
             return self.generate()
             return self.generate()
 
 
+        if init_state:
+            words = list(init_state) + words
+
         text = ""
         text = ""
         for word in words:
         for word in words:
             if word in "-–—" or not all(c in string.punctuation for c in word):
             if word in "-–—" or not all(c in string.punctuation for c in word):