For my initial foray into the computer generated erotic literature field, I wanted to start simple. I read around to get a basic idea of how Markov chains worked, looked into a few libraries to get started right away, and plugged in the first story from the first free erotic story website I could find.
A Simplified Markov Chain Explanation
The overall idea of a Markov chain is pretty simple. The algorithm runs over input text and marks how often word pairs are next to each other.
For a simple example, we’ll use the sentence, “I saw what I saw. The dog jumped the fence. The Dog!”
The computer would form a dictionary similar to this:
First Word
I
Saw
What
Saw
The
Dog
Jumped
The
Fence
Second Word
Saw
What
I
The
Dog
Jumped
The
Fence
The
Count
2
1
1
1
2
1
1
1
1
Notice how the repeated pairs increase in count. ‘I saw’ and ‘the dog’ appear multiple times.
From this data, the computer would construct probabilities for which word would follow a given input word. Our example is so simple that almost all the probabilities are 1. If the computer is given ‘Jumped’ as an input word, ‘The’ is the only possible output it knows. The only interesting case is the word ‘The’. ‘The’ has either ‘Dog’ or ‘Fence’ after it with 2 out of 3 cases ‘Dog’ appears. The algorithm uses this probability, so when asked for the next word after ‘The’ it will return ‘Dog’ in 2 out of 3 cases and ‘Fence’ in 1 out of 3 cases.
Now, I won’t break down when sentences end here. Let’s just say we want a 4 word sentence and our start word is the word ‘The’.
The algorithm set up with this model could output the following sentences:
The Dog Jumped The Dog – 44%
The Dog Jumped The Fence – 22%
The Fence The Dog – 22%
The Fence The Fence – 11%
As you can see, with this limited data we will likely get an incoherent sentence with a small chance of returning the same sentence seen in the story.
There’s still a large amount of randomness in this set up and hopefully this example illustrates why both sensical and illogical sentences can be output from a basic Markov chain set up.
My First Experiment: Markovify
To get started right away, I saved the first story from the first free erotic story website I could find to a text file. I actually used a scraper using the BeautifulSoup library as I wanted scale this to download and combine multiple stories into a single text file to use as a model.
With that text file as my model, I set up the example from the Markovify library and hit run. Already, I had my first results!
My First Results: Disconnected (and Hilarious) Nonsense
Overall, I was pretty happy with the outcome of these first experiments! To get an idea of how training on more stories impacts the output, I ran the same algorithm with datasets of 1, 5, 10, 25, and 50 stories.
Trained on a single story and without any context, the outcome is fairly admirable. The last sentence I find particularly humorous (and if from was substituted for fell, almost sensical).
I felt his hands on me, the more I felt his hands up and touch my pussy.
I pressed my hand out from under my panties and bare skin.
I tried to move his hand all the room.
I wiggled my ass in the middle.
I couldn’t get his hand fell between my panties so he could feel the cool air from the car’s air conditioner.
Trained with five stories:
Youre much better than yours my dear sister.
Then she lifted the breasts and then as she stroked it with us.
This was very good at it.
She was standing in the female anatomy before you wake Mom and Dad.
When I put on a pair of sky blue silky pajama pants and freed his shaft at the clock on the couch while Patty lay stretched on her back and did what his mother hadnt taught him.
Trained with ten stories:
He kept his tongue brought the crotch and feeling the hardness of his cum as it sucked the cock plunging in and out of Arts cum as she fought to control his rising rod.
I lick along the veins of my own son would be cheating if you dont care about Tony.
Well, if they really all that would be just between the crack of my ass, Kathy Adams continued to suck on James cock in it once again.
This time there was no denying there was some way to the floor in his pants.
Then he saw that he was standing behind me.
Trained with 25 stories:
Go get her to let her son and drew a lungful of smoke deep into her willing vagina.
When the Pizza arrived I called out, Its okay, James stammered as joy flooded through me.
He could smell her sex out at football practice and that she was in boxers only, I shuffled over on her every word.
She set her briefcase down and held it out before looking into the house, looking at John.
Where did that with me, I complained with a room with Kelly right at her ass.
Trained with 50 stories:
Bit of a girl of their tongues were getting hard?
Shit, John said simply, smiling at them.
She kissed me back and pulling her shirt had pulled her towards him on the side.
Pushing my tongue deep in your pussy wants you to look at the movies or not?
But be warned, I will get you a virgin, I clarify, if somewhat crudely.
More 50 stories:
I could squeeze one more time.
When, she took then she leaned forward, smiling.
I moaned, Oh, Mom, Sarah said.
Steve applauded and they were undressing in front of him like an addiction.
Please RSVP to the one in the day before.
What kind of disgusted, yet the symptom of lust was temporarily satisfied, Melissa and Eric either climaxed in her.
Im just not so much as they began to move in and out of her pleasure.
He knew he wouldnt have hesitated, but it wasnt possible.
Look, if you were wonderful!
She said looking across the page and left the Island, yet Danny pays a company who built the intensity of the meeting.
200 stories:
By the time they finally overrode us and we were heard?
I wondered how big is his fee) and sped off behind her, and to wash it, avoiding any discussion we had, but she knew I had spotted her stealing a couple of years old.
I began to scream at him for once.
For a few moments to decipher the meaning was clear.
Is that for me … a …
Smiling and patting her shoulder and met Victoria who smiled and reached down and pull his arms around him and what the hell had Miss Ross released my spent cock in my shorts, her usual sweet way of trying a hostile takeover.
Angie’s eyes rolled back over her body.
My dick immediately began assembling our fishing trip!
Just relax, and then her upper right arm around me and was biting her lip, looking at her until he was carrying some plastic bags.
Oh, come on Cat…. Don’t stop Ronnie!
All 250 stories:
And public blow-jobs were part of her hit me at my ass and pussy.
I snapped myself out of her office.
I didn’t want to be.
I spotted the courtyard.
Puddles of sweat drop from me, confusion and frustration.
You can’t help but notice how attractive she finds out?”
And I saw Godiva race once, she just playfully splashed water at this naked girl?
I was hoping that it was to be difficult.
OHHH YES….ARRRGHH BABY….OH SO GOOD….MMMM I cried again, now writhing with ecstasy as she went, waiting on this bucket of painting supplies and in the tips extending beyond the top floor showed just the kind of blow job I married.
She then sat on the sofa to put my cock quickly.
Anna giggled on the floor between us.
I… I haven’t even finished his inspection and all the while he humped up at him over what Miss Ross said quietly, glancing at her entrance, separating the kitchen and smiled.
Janet slowly started lowering myself down on his tiptoes.
I’ve never once thought I heard Starship Trooper’s is pretty impressive too.
Susan replied, nervously meeting her hopeful gaze.
He continued to lick her nipples, but her hips back so she led me by the thought—one that now everyone in their hands, Sue and my dad were the important dates memorized already.
My little travel wallet held four oversized cigars, and I followed a reluctant face.
Ive had enough sun I went home and leave the door to her clit.
Anna sighed at last.