Several years back, my colleague Ben and I developed a Chrome extension for editorial quality assurance. Ben provided the actual coding ability, and I was there to try and define the logic for the various rules we were trying to detect. We started with relatively simple checks, like preferred words, preferred spelling and capitalisation, checks for heading and link length, and some basic metadata checks… Then we thought, ‘it’d be cool if this could detect passive voice’…

So, how did we do it?

There are simple ways of explaining passive voice, but these are not easily replicated in JavaScript… So we had to bite in to the grammatical structure.

Consider the passive voice below:

The story was written by Kermit.

The bold bit was the key to being able to detect it. This pattern looks like:

Auxiliary verb + Past participle

[An auxiliary verb is a verb used just to carry the tense; it’s not your traditional ‘action’ word. The past participle is… Well, here’s an example: Today I eat. Yesterday I ate. I have eaten. Eaten is the past participle.]

So to detect this form with JavaScript, we just needed lists of all possible auxiliary verbs, and all past participles…

Auxiliary verbs

  • was
  • were
  • has been
  • will be
  • should be
  • can be
  • can not be
  • can’t be
  • could be
  • couldn’t be
  • could not be
  • must be
  • must not be
  • mustn’t be
  • was not
  • wasn’t
  • were not
  • has not been
  • will not be
  • shouldn’t be

I’m probably forgetting a few, but that’s most of them, as far as we’re likely to need. As we weren’t using any fuzzy matching, the contraction forms (e.g. wasn’t) needed to be called out specifically.

For the past participles, we used the hundred most common verbs in English, plus a bunch of of ones common to government… Things like ‘implemented’ and ‘delivered’.

Ben incanted the sacred words while facing east and sacrificing a chicken to the gods of jQuery, and hurrah, we were away. It worked brilliantly. When passive voice was detected, it was highlighted yellow in the page, and the font was changed to fuchsia Comic Sans, making it so jarring that the author had to consider whether passive voice was appropriate for that particular situation.

And people who couldn’t grasp passive voice thought that it was voodoo.

Epilogue—But wait, it’s not that simple…

[An update from November 2017]


In the above text, besides the specific examples, there are 6 incidences of passive voice. Can you detect them all?

One of these wouldn’t have been picked up by our Chrome extension, even if we were checking for every possible past participle. Who knows why?

Put your smarty pants on and let me know in the comments. [Hint, it’s in the third paragraph.]