|
@@ -29,7 +29,12 @@ class Markov:
|
|
|
|
|
|
def generate(self, init_state=None):
|
|
|
if init_state is not None:
|
|
|
- init_state = tuple(self.tokenize(init_state))
|
|
|
+ init_state = tuple(init_state)
|
|
|
+
|
|
|
+ size = len(init_state)
|
|
|
+
|
|
|
+ if size < config.MARKOV_STATE_SIZE:
|
|
|
+ init_state = (markovify.chain.BEGIN,) * (config.MARKOV_STATE_SIZE - size) + init_state
|
|
|
|
|
|
words = self.chain.walk(init_state)
|
|
|
if not words:
|