06 May 2016
courses, documentation, rwet
My final project for Reading Writing Electronic Text uses Markov chains to generate new trucker CB slang. To put some structure around this new slang, I created a mad lib using the timeless trucker song, "Convoy" by CW McCall. For good measure, I threw in some American Revolutionary War terms into the initial corpus of CB lingo.
The original "Convoy" go like this:
And the mad lib formula I used looks like this:
Add a little magick, the end result looks like
***
***
I began by gathering a corpus of terms and definitions of CB slang from various pages around the web. My initial idea was to just focus on CB slang, but I realized these phrases already make no sense to the average person, so running them through a Markov chain to generate even more nonsensical phrases would create an output that would be utterly lost on the reader.
I needed to spice up the corpus in some way, and after trying out a few different ideas for mashups (lyrics from popular songs, TV shows, etc), I settled on terms from the American Revolution. The two seem to pair together well - both have a "don't tread on me"/tea party vibe; maybe there's a commentary on the declining American working class; and I'm told there was some sort of connection between truckers and the U.S. bicentennial in 1976.
To get the mad lib to work, I separated the the corpus into different lists - ones for rigs, places, CB greetings, events, things, people, cops, driving/speed, facts.
***
The code is at https://gist.github.com/coblezc/beebac421898d24e714e532271508880
I created text files for both terms and definitions for each of these different lists. I ran each of those through a Markov generator and then combined them into dictionaries for each list. For example, I would run places-terms.txt and places-definitions.txt through the Markov generator, and then combine the two outputs into a dictionary of places.
After creating the structure for the Convoy mad lib, the program would pick a random term to fill in each blank. I also saved the definitions of each term in a glossary to be printed underneath the generated song lyrics.
Here's what the full output looks like:
***