Certainly, good writing is more than just varied sentence length, but this is a fantastic visualization that makes an excellent point. It wouldn’t hurt to be able to see this kind of thing in our own writing, in an on-demand fashion while editing.
After tweeting that I wasn’t quite sure how best to go about it, a bunch of folks chimed in with their takes on how they would do it.
Dave took a crack at it within a single tweet. His idea is essentially:
Loop through all paragraphs.
Make an array of sentences by splitting the whole string on periods.
Wrap each sentence in a span with a data attribute of how many words in that sentence.
The data attributes could then be used in CSS selectors to colorize. The idea didn’t quite work as written, but I was able to extrapolate that idea into a working concept, if slightly more verbose:
Doesn’t take into account almost any edge case. Note the hyphenated word fail there. Things like “Mrs. Robinson” would be an obvious edge case this doesn’t deal with.
Isn’t particularly efficient.
Before we get too far here, It was pointed out several times to me that the UI shown in that tweet looks an awful lot like Hemmingway App.
Indeed it does. I wonder if it’s some kind of hidden feature or something? I wasn’t able to find any sentence length colorizer feature poking around in there a bit. It highlights other things in useful ways though.
And speaking of highlighting sentences for useful alterior purposes, Tone Analyzer is an experiment to do that:
There is also an Angular JS lib that can be used to colorize arbitrary lengths of text:
The original tweet was all about the beauty of varied sentence length. Beauty in how the writing feels and reads. It wasn’t really about the colors or visualization of it, that just served to explain the message. But the colors were kinda beautiful too.
In another bit of prior art here, Sanne Peters did some visualized poems that maps words to colors so you can see them as well as read them: