Feed Sign in with OpenID OpenID

Simon Willison’s Weblog

Omit needless words, codified

I continue to try to improve my writing. “Omit needless words” is all well and good, but identifying needless words can be a difficult task for the untrained eye. Paul Ford’s Passivator bookmarklet highlights adverbs and passive verbs, both of which can indicate weak writing.

This is Omit needless words, codified by Simon Willison, posted on 27th March 2004.

View blog reactions

Next: PHP and Apache 2.0

Previous: It's only going to get worse

14 comments

  1. I wonder how well Joyce would have fared with his "Ulysses". Would a single page survive? :)

    M.

    Moose - 28th March 2004 00:23 - #

  2. But Joyce would know why each verb was there, and choose accordingly. Passive constructions, adverbs, and the like are not bad, but are often abused by lazy writers like myself. A little toy to light them up on the page might keep me off the garden path to sloppy prose.

    Paul Ford - 28th March 2004 02:03 - #

  3. Wow! This is going to help me a lot. Oh yeah, one thing: it doesn't seem to work on your site.

    Tom - 28th March 2004 19:35 - #

  4. Tom: I noticed that. I think it's because my site is served up as application/xml+xhtml.

    Simon Willison - 28th March 2004 20:10 - #

  5. Huh. That's new to me; I have no idea how to get around it.

    Paul Ford - 28th March 2004 20:30 - #

  6. The ly detector seems to work, but not the Passivator.... perhaps I'll investigate.

    Gina - 30th March 2004 22:27 - #

  7. The problem is innerHTML is non-standard.

    Apparently, Mozilla's DOM implementation for XHTML-MIME'd content doesn't support it.

    That, unforunately, kills that chance of using string.replace(/regex/,"$1<span>$2...") to do the work.

    I took it as a personal challenge to get this working using DOM manipulation, since I could use the practice.

    But it's turned out to be surprisingly non-trivial. I hadn't finished it yet, and so had not commented.

    But my advice to people writing code for content with the XHTML mime-type is to use DOM 2 Core at most. Don't expect anything non-standard in an XHTML-mode client (at this point), and I'm not even sure it's safe to expect HTML DOM.

    Jeremy Dunck - 30th March 2004 23:04 - #

  8. Oh yeah, another thing about the Passivator, maybe it could be made to recognize the imperfect tense? He was running when a dog barked at him. Possibly with: /(?:was|were) \w*ing/igm (that would be the regular expression to match imperfect [or at least, I hope it works])

    Yeah, I heard about innerHTML not being standard. (on scriptygoodness, I think)

    Eh... that's not good. How else are you supposed to do it? You could use textContent to match it, I suppose, but I still don't know how you'd make the span tags. document.createElement; document.replaceChild, but what would you replace?

    Tom - 31st March 2004 05:38 - #

  9. You have to split the textNodes, and replace the node containing the offending bit of text with a span containing the text.

    I just haven't figured out how to get an offset (necessary for the split) from a RegExp match. The hack approach I came up with is to split all textNodes into tokens containing with all whitespace or all non-whitespace, and then if the RegExp matches, do the swap.

    innerHTML is damned useful-- there's a significant disconnect between the standard and common usage here.

    Jeremy Dunck - 31st March 2004 17:40 - #

  10. The javascript on Paul's page has an error in the regex that matches passive verbs. The regex for "you're" is missing the escaping back slash.

    This is great and all, but what about something to use in your favorite editor? I don't use Word, or the like when writing, especially for Blogs.

    Tzicha - 31st March 2004 21:11 - #

  11. If you want to fix bugs other than the XHTML issue, there is also the problem that it will only execute the replacements if verbsRE is satisfied.

    As far as I can tell, this could be completely removed:

    if(verbsRE.test(tempNodeVal))

    Jeremy Dunck - 31st March 2004 22:20 - #

  12. I just haven't figured out how to get an offset (necessary for the split) from a RegExp match. Maybe you could use charAt? Or you could split every single word up (matching a space) and loop through those textNodes.

    The javascript on Paul's page has an error in the regex that matches passive verbs. The regex for "you're" is missing the escaping back slash. Oh yeah, you're right. He fixed it now, though.

    This is great and all, but what about something to use in your favorite editor? I don't use Word, or the like when writing, especially for Blogs. I was going to say that. :-D

    Tom - 1st April 2004 05:19 - #

  13. um .... "Omit needless words" ... isn't that a bit wordy?

    Eschew Surplusage.

    :-)

    For a good lesson in writing, pick up the SHORT book "Elements of Style" by Strunk & White. Its the best 90 pages you can give to your writing.

    Erik

    Erik - 4th May 2004 02:29 - #

  14. I already have - that's the book "omit needless words" comes from ;)

    Simon Willison - 4th May 2004 04:59 - #

Comments are closed.

Previously hosted at http://simon.incutio.com/archive/2004/03/27/omit

A django site