In [1]:
text_15 = open("fifteen.txt").read()
text_16 = open("sixteen.txt").read()
text_17 = open("seventeen.txt").read()
text_19 = open("nineteen.txt").read()
text_21 = open("twentyone.txt").read()
text_22 = open("twentytwo.txt").read()
text_23 = open("twentythree.txt").read()
In [2]:
import markovify
In [3]:
# change to "word" for a word-level model
level = "char"
# controls the length of the n-gram
order = 8
# controls the number of lines to output
output_n = 4
# weights between the models; text A first, text B second.
# if you want to completely exclude one model, set its corresponding value to 0
weights = [0.5, 0.5]
# limit sentence output to this number of characters
length_limit = 80
In [4]:
class SentencesByChar(markovify.Text):
    def word_split(self, sentence):
        return list(sentence)
    def word_join(self, words):
        return "".join(words)

import textwrap
In [144]:
print("Slip")
print()
print()

model_cls = markovify.Text if level == "word" else SentencesByChar
gen_15 = model_cls(text_15, state_size=order)
gen_16 = model_cls(text_16, state_size=order)
gen_1516 = markovify.combine([gen_15, gen_16], weights)
first_line = "I am 15."
print(" ".join(first_line))
for i in range(output_n):
    out = gen_1516.make_short_sentence(length_limit, test_output = False)
    out = out.replace("\n", " ")
    print(out)
print()
print("                                                                                                 I slipped into 16.")
print(textwrap.fill(" ".join(out))[:60])

gen_16 = model_cls(text_16, state_size=order)
gen_17 = model_cls(text_17, state_size=order)
gen_1617 = markovify.combine([gen_16, gen_17], weights)
for i in range(output_n):
    out = gen_1617.make_short_sentence(length_limit, test_output = False)
    out = out.replace("\n", " ")
    print(out)
print()
print("                                                                                                 I slipped into 17.")
print(textwrap.fill(" ".join(out))[:60])

gen_17 = model_cls(text_17, state_size=order)
gen_19 = model_cls(text_19, state_size=order)
gen_1719 = markovify.combine([gen_17, gen_19], weights)
for i in range(output_n):
    out = gen_1719.make_short_sentence(length_limit, test_output = False)
    out = out.replace("\n", " ")
    print(out)
print()
print("                                                                                                 I slipped into 19.")
print(textwrap.fill(" ".join(out))[:60])

gen_19 = model_cls(text_19, state_size=order)
gen_21 = model_cls(text_21, state_size=order)
gen_1921 = markovify.combine([gen_19, gen_21], weights)
for i in range(output_n):
    out = gen_1921.make_short_sentence(length_limit, test_output = False)
    out = out.replace("\n", " ")
    print(out)
print()
print("                                                                                                 I slipped into 21.")
print(textwrap.fill(" ".join(out))[:60])

gen_21 = model_cls(text_21, state_size=order)
gen_22 = model_cls(text_22, state_size=order)
gen_2122 = markovify.combine([gen_21, gen_22], weights)
for i in range(output_n):
    out = gen_2122.make_short_sentence(length_limit, test_output = False)
    out = out.replace("\n", " ")
    print(out)
print()
print("                                                                                                 I slipped into 22.")
print(textwrap.fill(" ".join(out))[:60])

gen_22 = model_cls(text_22, state_size=order)
gen_23 = model_cls(text_23, state_size=order)
gen_2223 = markovify.combine([gen_22, gen_23], weights)
for i in range(output_n):
    out = gen_2223.make_short_sentence(length_limit, test_output = False)
    out = out.replace("\n", " ")
    print(out)
print()
print("                                                                                                 I slipped into 23.")
Slip


I   a m   1 5 .
Even though I turned 15, I feel 13, or 12.
Today is my 15th birthday.
It was fantastic.
For the first time in my life that I’ve shaped.

                                                                                                 I slipped into 16.
F o r   t h e   f i r s t   t i m e   i n   m y   l i f e   
My dad forgot my birthday.
The poor man doesn’t deserve the treatment he gets from Karina.
I’m still afraid of the dark.
16 is such a teenager!

                                                                                                 I slipped into 17.
1 6   i s   s u c h   a   t e e n a g e r !
I don’t want to devote further space to the topic.
My team members were really shitty, but I’m so grateful for that.
17 year old Nick strives for success.
In the end, I’ve recognized the most self-absorbed people I’ve ever met.

                                                                                                 I slipped into 19.
I n   t h e   e n d ,   I ’ v e   r e c o g n i z e d   t h 
I also shattered a bottle.
They didn’t do anything for my birthday party.
I also like his girlfriend Rammy.
I can no longer live here.

                                                                                                 I slipped into 21.
I   c a n   n o   l o n g e r   l i v e   h e r e .
I’m glad to say that I am a dick.
My roommate Tom is very nice, clean, and we actually hang out.
Anyways, I am getting my first test, but still failed badly.
People treat me with respect.

                                                                                                 I slipped into 22.
P e o p l e   t r e a t   m e   w i t h   r e s p e c t .
I slip into a very dark place.
I accepted that I am 22, I have better grades than her.
I thought being vulnerable ever pays off – unless in art.
Life will only get better.

                                                                                                 I slipped into 23.
In [ ]: