scripts/saiba80/saiba80.py

23 lines
613 B
Python

import markovify
with open("sources/combined.txt", "r") as f:
data = f.readlines()
corpus = ""
for row in data:
corpus += row.strip() + ". "
model = markovify.Text(corpus, state_size=1)
gen = None
for r in range(1):
while gen == None:
gen = model.make_short_sentence(140)
remove_chars = [".", ":", "?", "!", ", ", "A ", "Any ", "By ", "Can't ",
"For ", "From ", "In ", "Me ", "Movie", "Of ", "The ", "To ",
"What ", "When ", "Where ", "With ", "You ", "and "]
for chars in remove_chars:
gen = gen.replace(chars, "")
gen = gen.replace(chars.lower(), "")
print(gen)