slopnchop

Markov-generated text for screenplays/scripts


Keywords
auto-generated-content, markov-text, markovify, screenplay
License
MIT
Install
pip install slopnchop==0.1

Documentation

slopnchop

This is a modest commandline utility that uses Markov models to generate scripts from screenplays. It is named after the user SlopNChop on UrbanDictionary, whose insane ramblings inspired this code.

Each speaker is given their own Markov model so speakers tend to talk like themselves. The speaker order is decided with a Markov model, and additionally speakers are increasingly likely to speak next if the previous line references them. See --help for details.

The text-based Markov models are accomplished using the Python library markovify.

Requirements

  • Python 3

(see also requirements.txt)

Installation

Method 1

git clone https://github.com/ekiefl/slopnchop.git
cd slopnchop
sudo python setup.py install

Usage

Once installed, slopnchop can be run from the command line:

slopnchop -i examples/harry_potter_1_script.txt

the above command yields the following result:

SCENE 1:
========
HAGRID: {sniffs and sighs} Norbert’s gone. Dumbledore sent him off an Irish feller I met down at a pub. Seemed quite glad to be rude, but I’m in no fit state to entertain today. {Closes door.}

DUMBLEDORE: What happened down in the dungeons between you and me thats saying something. {Smile both.}

Hagrid comes over, grabs the broom. All the while, he is screaming. He begins to move. The three gape.

MCGONAGALL: Albus, do you know


SCENE 2:
========
HARRY: Excuse me! C-could you tell me how to get past that 3 headed dog. But, he got himself bitten, that’s why he’s limping.

The group runs. Flames are lit as they strategize to score. Johnson takes it, throws, and once again scores!


SCENE 3:
========
Food magically appears on a stairwell balcony Hermione and Ron are talking. They stop when they stop, because there is a silver centaur, FIRENZE. It rears, and the camera pans into the air, across from Draco.

DRACO: I’m afraid so, Professor. The good, and the camera pans on a rock island somewhere out at Vernon drilling wood over the railing.

VERNON: Give me that! Give me that! Give me that! Give me that! Give me that letter!

HARRY: Excuse me, Sir. Can you tell me where I might find Platform 9 ¾? But Hagrid, whatever Fluffy’s guarding, Snape’s trying to steal it.

HAGRID: Right then. This way to the boats! Come on, now, don’t be shy! Come on now, hurry up!

There are a couple options worth looking into that can be accessed with:

slopnchop --help

Input format

An example format can be found in examples/harry_potter_1_script.txt:

A neighbourhood on a street called Privet Drive. An owl, sitting on the street sign flies off to reveal a mysterious appearing old man walking through a forest near the street. He stops at the start of the street and takes out a mechanical device and zaps all the light out of the lampposts. He puts away the device and a cat meows. The man, ALBUS DUMBLEDORE, looks down at the cat, which is a tabby and is sitting on a brick ledge.



Dumbledore: I should have known that you would be here...Professor McGonagall.



The cat meows, sniffs out and the camera pans back to a wall. The cats shadow is seen progressing into a human. There are footsteps and MINERVA MCGONAGALL is revealed.



McGonagall: Good evening, Professor Dumbledore. Are the rumours true, Albus?



Dumbledore: I'm afraid so, Professor. The good, and the bad.

McGonagall: And the boy?

Dumbledore: Hagrid is bringing him.

Speaker names should exist on the same line as the spoken line. Lines without speaker names, e.g. A neighbourhood on a street called Privet Drive [...] can exist freely.

Another example text can be generated with slopnchop --get-example.