In the midst of making my own initial forays into Python, I was fiddling around last night with a simple exercise: to make a script that grabs lines containing a given word from a source text and spits them into a new file. Veteran digital humanists will recognize this as a real kindergarten task—but I stumbled across a Shakespearean remix, a generative bagatelle, which tickled my fancy nonetheless.
I was using as a source Project Gutenberg’s text file of Shakespeare’s Sonnets (and following the great instructional Python recipes cooked up by data-driven journalism maven Ben Welsh at palewire). Running searches on words like “love” or “heart” or “thine” produces variously copious results. Running the script on the regular expression “(P|p)lace” returned the following result:
But for the “Right of Replacement or Refund” described below,
such person may choose to alternatively give you a replacement
 Honor the etext refund and replacement provisions of this
Make sweet some vial; treasure thou some place
Shifts but his place, for still the world enjoys it;
As soon as think the place where he would be.
Like stones of worth they thinly placed are,
Each changing place with that which goes before,
And my sick Muse doth give an other place.
And place my merit in the eye of scorn,
Thy looks with me, thy heart in other place:
Nor gives to necessary wrinkles place,
Thy black is fairest in my judgment’s place.
Which my heart knows the wide world’s common place?
What I end up with isn’t a sonnet, although it is fourteen lines long; it lacks some crucial assemblage of the rhetorical and stanzaic effects that the form requires. Instead it’s one of numberless implicit quatorzains (the genus of which “sonnet” is a species) hiding in the .txt, held together by the generative conditions imposed by a half-dozen lines of code. Not bothering to distinguish between the ostensible poetic text and the latter-day metadata in the file’s header, it comes together as a softly teeming cloud of semantic possibility—place that assembles, place that ranks, place that scores shifting measures of absence and compensation—all clustered around a regex that submits to the uncanny demands of the machine’s sensibility. “And my sick Muse doth give an other place,” indeed.