Redacting the US Constitution
As citizens, we all have an obligation to intervene and become involved – it’s the citizen who changes things.
José Saramago
This week for Programming A to Z I was asked to make use of “something external” in a browser-based text experiment. Having already explored the Datamuse API with a time rhyming site I turned my attention more specifically to working with data from the JavaScript fetch() API.
Perhaps it is a product of the era we are living in, of “fake-news”, twitter deletions, and damning government reports, but redaction has been on my mind a lot lately. The idea that words and the ideas in them can be so compromising that they must be removed from public view I find endlessly fascinating.
Thinking about how to tie redaction into a a browser-based text experiment was the next challenge. The obvious candidates were partially classified government documents. Could I make use of the Mueller report? Looking at a public copy online I found that the formatting and optical character recognition (OCR) of the PDFs I had access to had numerous errors and would be a difficult starting point. OCR was especially unkind to the redactions often turning them into a random string of characters:
-~'<-,’•,•••• ~ •~’·,I -• •·,~•,•,•<
Hmm. Beginning with a well formatted text file would be much easier.
My sights turned to something readily available: the US Constitution. The source is in the public domain and I found a text file online courtesy https://www.usconstitution.net/const.txt
After calling the text in using the fetch() function I made use of split() and replace() and some regular expressions to divide the text into fragments and randomly present them back to the viewer. While this is something I am definitely interested in exploring further in its current incarnation nouns that are assigned power in the text, such as the “Senate” or “States”, are redacted on load and replaced on a click with who I think is ultimately in power.
Sticking with the public domain theme I have paired this experiment with Creative Commons music courtesy Nine Inch Nails under a share-share alike license.