Saturday, February 28, 2015

Morse Code

A couple days ago, Verizon posted a press release complaining about the FCC's recent changes to Internet regulations. Normally, I wouldn't really bother with things like this, but they posted their statement using morse code. While it would be easy enough to read their English version, I thought it would be fun to decode it using Factor.

This feels a little wonky and a little fragile, but part of that is probably not having higher level words that we can use for moving between parsed HTML and its TEXT representation.

USING: html.parser html.parser.analyzer html.parser.printer
http.client io kernel morse sequences splitting wrap.strings ;

Step 1. Download the blog post and parse the HTML.

"http://publicpolicy.verizon.com/blog/entry/fccs-throwback-thursday-move-imposes-1930s-rules-on-the-internet"
http-get nip parse-html

Step 2. Extract the morse code text from the post.

"blog" find-by-class-between
"p" find-between-first html-text

Step 3. Split the morse code into words.

"  " split-subseq

Step 4. Parse each word's morse code, joining and wrapping the text.

[ morse> ] map " " join 60 wrap-string print

The result is:

today's decision by the fcc to encumber broadband internet
services with badly antiquated regulations is a radical
step that presages a time of uncertainty for consumers,
innovators and investors. over the past two decades
a bipartisan, light-touch policy approach unleashed
unprecedented investment and enabled the broadband internet
age consumers now enjoy. the fcc today chose to change
the way the commercial internet has operated since its
creation. changing a platform that has been so successful
should be done, if at all, only after careful policy
analysis, full transparency, and by the legislature, which
is constitutionally charged with determining policy. as a
result, it is likely that history will judge today's actions
as misguided. the fcc's move is especially regrettable
because it is wholly unnecessary. the fcc had targeted tools
available to preserve an open internet, but instead chose to
use this order as an excuse to adopt 300-plus pages of broad
and open-ended regulatory arcana that will have unintended
negative consequences for consumers and various parts of the
internet ecosystem for years to come. what has been and will
remain constant before, during and after the existence of
any regulations is verizon's commitment to an open internet
that provides consumers with competitive broadband choices
and internet access when, where, and how they want.