@Helixable/

Markov Chain Test

Python

No description

fork
loading
Files
  • main.py
  • Output.txt
  • speeches.txt
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import markovify
import sys
open('Output.txt', 'w').close()
sys.stdout = open("Output.txt", "w+")
# Get raw text as string.
with open("speeches.txt") as f:
    text = f.read()

# Build the model.
text_model = markovify.Text(text)
print("\n ____S T O R Y____ \n")
print(text_model.make_short_sentence(25)+"\n"+ "Written by: Markov Makr"+" \n")


# Print five randomly-generated sentences
for i in range(20):
	print("\n"+str(text_model.make_short_sentence(30))+"\n")

	for u in range(140):
		print(text_model.make_sentence())
	
print("\n _____E N D_____ \n")
# Print three randomly-generated sentences of no more than 280 characters