I created a python program the transforms literary texts into legal contracts. The script, which you can view on github, uses pattern-en and nltk.
Here’s a sample contract that uses Hemingway’s “The End of Something” as the source:
================
*** CONTRACT ***
================
_____________________________, henceforth known as “The Artist,” agrees to the following:
SECTION 1
The Artist will be a lumbering town. The Artist, a town. The Artist and The Artist agree to row along the shore. The Artist, rowing, will look at the white stone in the green trees. The Artist will say nothing.
SECTION 2
The Artist agrees to cut across the bay. The Artist agrees to be intent on the rod all the time they troll, even when The Artist agrees to talk. The Artist is obliged to love to fish. The Artist agrees to love to fish with The Artist.
SECTION 3
Within 30 days The Artist will pull hard on one oar so the boat will turn and the bait spinning far behind would pass where the trout will be feeding. The Artist hereby agrees to row the boat around to troll past both the feeding fish, then head it for the point. The Artist shall not reel in until the boat touch the shore.
SECTION 4
The Artist shall lift out a pail of live perch. The Artist will catch three of them with his hands and cut their heads off and skin them while The Artist chased with her hands in the bucket, finally catch a perch, cut its head off and skins it. The Artist agrees to look at her fish. The Artist must row the boat out over the channel-bank, holding the line in her teeth, and looking toward The Artist, who will stand on the shore holding the rod and letting the line run out from the reel. The Artist is required to come in with the boat and run the second line out the same way.
SECTION 5
The Artist will set a heavy slab of driftwood across the butt of the rod to hold it solid and prop it up at an angle with a small slab. The Artist must reel in the slack line so the line runs taut out to where the bait rest on the sandy floor of the channel and set the click on the reel. The Artist will row up the point a little way so The Artist would not disturb the line. The Artist will pull hard on the oars and the boat will go way up the beach.
SECTION 6
Within 6 days The Artist is obliged to step out of the boat and The Artist agrees to pull the boat high up the beach. The Artist shall go to the boat and bring a blanket. The Artist will spread the blanket out between the fire and the lake. The Artist agrees to sit on the blanket with her back to the fire and wait for The Artist. The Artist must come over and sit down beside her on the blanket.
SECTION 7
In a timely fashion The Artist shall look across the bay to the hills that begin to sharpen against the sky. The Artist hereby agrees to know the moon will be coming up. The Artist will look at her.
SECTION 8
Within 6 days The Artist is obliged to sit there with her back toward him. The Artist will look at her back. The Artist will go on.
SECTION 9
The Artist will stand up. The Artist is obliged to sit there, his head in his hands. The Artist agrees to be afloat in the boat on the water with the moonlight on it.
SECTION 10
By no later than April 14th, The Artist is required to go back and lay down with his face in the blanket by the fire. The Artist hereby agrees to lay there for a long time. The Artist will lay there while The Artist hears The Artist come into the clearing, walking around through the woods. The Artist is obliged to feel The Artist coming up to the fire.
================
Date: ________________________
Name: ________________________
Signature: ________________________
And here’s how the code works:
- replace all proper nouns, and “he”s and “she”s with the phrase “The Artist”
- search for sentences that contain the phrase “The Artist” and a verb
- replace the verb with a legalist imperative
- chop off anything in each sentence before the words “The Artist”
- split the text into numbered sections that are between 3 and 6 sentences long
- add a legalistic header and footer