Improving writing with proselint
What is this project's goal? The word from the front page of its web site is:
Installation of proselint is simple; like many Python utilities, it seems to have bypassed the ordinary distribution channels and can be installed directly with pip. It is a command-line tool; running it on a text file will, by default, result in any warnings being written to the standard output. This is clearly not the expected use, though; it is more likely that proselint will be integrated into other tools that can present its advice in a more friendly manner. To help make this integration easy, proselint can be asked to format its output as JSON rather than plain text.
As a result, it is easy to use proselint as part of the Emacs Flycheck mode, for example; it is a simple matter of adding a few lines to the .emacs file. Once a buffer has been put into flycheck-mode, the text therein will be occasionally checked for problematic English, and the offending text will be highlighted; hovering over that text with the pointer will yield the associated message.
Your editor went searching for some high-quality text to test this tool against. After pondering the classics from Project Gutenberg, the GNU Manifesto, and Trump speech transcripts, the search settled a little closer to home — the kernel's documentation directory. Playing with the Flycheck integration in Emacs quickly yielded results like this:
That is good advice indeed, but, in truth, most of what comes out of
proselint is less helpful. By far the bulk of the warnings are either
(1) using both one and two spaces after a period, or (2) failure
to use curly quotes. Neither warning is all that helpful for a writer who
was hoping for, as the web site promises, "the world’s greatest
writers and editors by your side, where they whisper suggestions on how to
improve your prose
". Instead, it feels a bit more like one of the
world's worst elementary-school teachers criticizing you in front of the
entire class about irrelevant details.
But, then, proselint is a new tool, so there is hope for the future. The success of such a tool depends on two things: the rules it uses to analyze text, and the flexibility of the engine that interprets those rules. The rules themselves are written as Python code; here, for example, is the core of the rule that generated the message shown above:
@memoize
def check_very_damn(text):
err = "twain.damn"
msg = ("Substitute 'damn' every time you're "
"inclined to write 'very;' your editor will delete it "
"and the writing will be just as it should be.")
regex = "very"
return existence_check(text, [regex], err, msg, max_errors=1)
There are various other functions for performing checks on text, but they all have the same core nature: they are applying regular expressions to the text as a way of triggering rules. That makes rules relatively easy to write, but also limits how smart the tool can actually be. It can readily pick out specific words or combinations of words, but will be hard pressed to offer advice that requires a deeper understanding of the subject text.
A look at the code shows that some thought has been put into making the core engine smarter; there are stubs for functions that can extract specific amounts of context or try to determine what the topic of a range of text is, for example. But stubs is all they are at this point; a lot of work will need to be filled in before this tool can come close to the ambitious goals its developers have set.
One can only wish them luck. There is a lot of advice for writers out
there, but it can be hard to even read it all, much less keep it all in
mind when actually writing or editing a piece of text. If it were possible
to distill a significant part of that advice into a form where it could be
applied automatically, the result might be better writing all around. That
is a result that one could be damn happy about.
