forked from mio/scripts
32 lines
848 B
Python
32 lines
848 B
Python
|
import markovify
|
||
|
|
||
|
with open("sources/games.txt", "r") as f:
|
||
|
data_games = f.readlines()
|
||
|
with open("sources/toys.txt", "r") as f:
|
||
|
data_toys = f.readlines()
|
||
|
with open("sources/tv.txt", "r") as f:
|
||
|
data_tv = f.readlines()
|
||
|
|
||
|
corpus_games = ""
|
||
|
for row in data_games:
|
||
|
corpus_games += row.strip() + ". "
|
||
|
model_games = markovify.Text(corpus_games, state_size=1)
|
||
|
|
||
|
corpus_toys = ""
|
||
|
for row in data_toys:
|
||
|
corpus_toys += row.strip() + ". "
|
||
|
model_toys = markovify.Text(corpus_toys, state_size=1)
|
||
|
|
||
|
corpus_tv = ""
|
||
|
for row in data_tv:
|
||
|
corpus_tv += row.strip() + ". "
|
||
|
model_tv = markovify.Text(corpus_tv, state_size=1)
|
||
|
|
||
|
model = markovify.combine([model_games, model_toys, model_tv], [1, 1, 3])
|
||
|
|
||
|
gen = None
|
||
|
for r in range(1):
|
||
|
while gen == None:
|
||
|
gen = model.make_short_sentence(50)
|
||
|
print(gen.replace(".", "").replace(":", ""))
|