import markovify

text = ""
# Get raw text as string.
with open("titles.txt") as f:
    text = f.read()

# Build the model.
text_model = markovify.Text(text)

# Print five randomly-generated sentences
# Print three randomly-generated sentences of no more than 140 characters
for i in range(400):
	thing = text_model.make_short_sentence(50)
	try:
		if i == 14:
			with open('test.txt', 'a') as the_file:
				the_file.write("\"" + thing + "\"" + "\n")
		else:
			with open('test.txt', 'a') as the_file:
				the_file.write("\"" + thing + "\"," + "\n")
	except Exception as e:
		pass