Naive linter for English prose for developers who can't write good and wanna learn to do other stuff good too.
npm install write-good
Important: Do not use this tool to be a jerk to other people about their writing.
writeGood
is a function that takes a string and returns an array of suggestions.
var writeGood = require('write-good');
var suggestions = writeGood('So the cat was stolen.');
// suggestions:
//
// [{
// suggestion: "omit 'So' from the beginning of sentences",
// index: 0, offset: 2
// }, {
// suggestion: "'was stolen' is passive voice",
// index: 11, offset: 10
// }]
writeGood
takes an optional second argument that allows you to disable certain checks.
You can disable checking for passive voice like this:
var writeGood = require('write-good');
var suggestions = writeGood('So the cat was stolen', { passive: false});
// suggestions: []
You can use the second argument's checks
property to pass in custom checks instead of write-good
's default linting configuration.
Like this, you can check non-English documents, for example with the linter extension for German language, schreib-gut (experimental):
var schreibGut = require('schreib-gut');
writeGood('Aller Wahrscheinlichkeit nach können Entwickler nicht gut schreiben', { weasel-words: false, checks: schreibGut});
// suggestions
// [{index : 0, offset : 29, reason : '"Aller Wahrscheinlichkeit nach" is wordy or unneeded' }]
You can use write-good
as a command-line tool by installing it globally:
npm install -g write-good
write-good
takes a glob and prints suggestions to stdout:
$ write-good *.md
In README.md
=============
= writeGood('So the cat was stolen.');
^^^^^^^^^^
"was stolen" is passive voice on line 20 at column 40
-------------
// suggestion: "'was stolen' is passive voice",
^^^^^^^^^^
"was stolen" is passive voice on line 28 at column 19
You can run just specific checks like this:
write-good *.md --weasel --so
Or exclude checks like this:
write-good *.md --no-passive
Or include checks like this:
# E-Prime is disabled by default.
write-good *.md --yes-eprime
You can run just with text without supplying files:
write-good --text="It should have been defined there."
You can even supply multi-line text:
write-good --text="I can't see a problem there that's not been defined yet.
Should be defined again."
You can also pass other arguments:
write-good --text="It should have been defined there." --no-passive
You can even fetch output from a remote file:
write-good --text="$(curl https://raw.githubusercontent.com/btford/write-good/master/README.md)"
To specify a custom checks extension, for example schreib-gut (experimental), run:
npm install -g schreib-gut
write-good *.md --checks=schreib-gut
You can disable any combination of the following by providing a key with value false
as the second argument to writeGood
.
Checks for passive voice.
Checks for lexical illusions – cases where a word is repeated.
Checks for so
at the beginning of the sentence.
Checks for there is
or there are
at the beginning of the sentence.
Checks for "weasel words."
Checks for adverbs that can weaken meaning: really, very, extremely, etc.
Checks for wordy phrases and unnecessary words.
Checks for common cliches.
Checks for "to-be" verbs. Disabled by default
I came across these resources while doing research to make this module. They might be helpful.
- shell script for avoiding "weasel words" – I based my initial implementation on this
- Academic Writing Check – a perl script similar to above
- writegood mode for emacs
- natural – general purpose NLP toolkit in JavaScript
- WordNet – lexical database of the English language
- LanguageTool – style and grammar checker implemented in Java
- linter-write-good for Atom
- Elements of Style
- Flesch–Kincaid readability
- Fear and Loathing of the English passive
- Words to Avoid in Educational Writing
This is not an endorsement. These apps have similar functionality that you may find useful.
MIT