Home

Awesome

<img src="https://raw.githubusercontent.com/amperser/proselint/main/logo.png" alt="proselint logo" width="200">

Workflow status Reviewed by Hound Code Climate codecov License

Writing is notoriously hard, even for the best writers, and it's not for lack of good advice — a tremendous amount of knowledge about the craft is strewn across usage guides, dictionaries, technical manuals, essays, pamphlets, websites, and the hearts and minds of great authors and editors. But poring over Strunk & White hardly makes one a better writer — it turns you into neither Strunk nor White. And nobody has the capacity to apply all the advice from Garner’s Modern English Usage, an 1100-page usage guide, to everything they write. In fact, the whole notion that one becomes a better writer by reading advice on writing rests on untenable assumptions about learning and memory. The traditional formats of knowledge about writing are thus essentially inert, waiting to be transformed.

We devised a simple solution: proselint, a linter for English prose. A linter is a computer program that, akin to a spell checker, scans through a file and detects issues — like how a real lint roller helps you get unwanted lint off of your shirt.

proselint places the world's greatest writers and editors by your side, where they whisper suggestions on how to improve your prose. You’ll be guided by advice inspired by Bryan Garner, David Foster Wallace, Chuck Palahniuk, Steve Pinker, Mary Norris, Mark Twain, Elmore Leonard, George Orwell, Matthew Butterick, William Strunk, Elwyn White, Philip Corbett, Ernest Gowers, and the editorial staff of the world’s finest literary magazines and newspapers, among others. Our goal is to aggregate knowledge about best practices in writing and to make that knowledge immediately accessible to all authors in the form of a linter for prose; all in a neat command-line utility that you can integrate into other tools, scripts, and workflows.

Installation

To get this up and running, install it using pip:

pip install proselint

Fedora

sudo dnf install proselint

Debian

sudo apt install python3-proselint

Ubuntu

sudo add-apt-repository universe
sudo apt install python3-proselint

Plugins for other software

proselint is available on:

Usage

Suppose you have a document text.md with the following text:

John is very unique.

You can run proselint over the document using the command line:

proselint text.md

This prints a list of suggestions to stdout, one per line. Each suggestion has the form:

text.md:<line>:<column>: <check_name> <message>

For example,

text.md:0:10: wallace.uncomparables Comparison of an uncomparable: 'unique' cannot be compared.

The command-line utility can also print suggestions in JSON using the --json flag. In this case, the output is considerably richer:

{
  // Type of check that output this suggestion.
  check: "wallace.uncomparables",

  // Message to describe the suggestion.
  message: "Comparison of an uncomparable: 'unique' cannot be compared.",

  // The person or organization giving the suggestion.
  source: "David Foster Wallace"

  // URL pointing to the source material.
  source_url: "http://www.telegraph.co.uk/a/9715551"

  // Line where the error starts.
  line: 0,

  // Column where the error starts.
  column: 10,

  // Index in the text where the error starts.
  start: 10,

  // Index in the text where the error ends.
  end: 21,

  // length from start -> end
  extent: 11,

  // How important is this? Can be "suggestion", "warning", or "error".
  severity: "warning",

  // Possible replacements.
  replacements: [
    {
      value: "unique"
    }
  ]
}

To run the linter as part of another Python program, you can use the lint function in proselint.tools:

import proselint

suggestions = proselint.tools.lint("This sentence is very unique")

This will return a list of suggestions:

[('weasel_words.very', "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.", 0, 17, 17, 22, 5, 'warning', None), ('uncomparables.misc', "Comparison of an uncomparable: 'very unique.' is not comparable.", 0, 17, 17, 29, 12, 'warning', None)]

Checks

You can disable any of the checks by modifying $XDG_CONFIG_HOME/proselint/config.json. If $XDG_CONFIG_HOME is not set or empty, ~/.config/proselint/config.json will be used. Additionally, for compatibility reasons, the legacy configurations ~/.proselintrc and $XDG_CONFIG_HOME/proselint/config will be checked if $XDG_CONFIG_HOME/proselint/config.json does not exist.

{
  "checks": {
    "typography.diacritical_marks": false
  }
}
IDDescription
airlinese.miscAvoiding jargon of the airline industry
annotations.miscCatching annotations left in the text
archaism.miscAvoiding archaic forms
cliches.hellAvoiding a common cliché
cliches.miscAvoiding clichés
consistency.spacingConsistent sentence spacing
consistency.spellingConsistent spelling
corporate_speak.miscAvoiding corporate buzzwords
cursing.filthWords to avoid
cursing.nflAvoiding words banned by the NFL
dates_times.am_pmUsing the right form for the time of day
dates_times.datesStylish formatting of dates
hedging.miscNot hedging
hyperbole.miscNot being hyperbolic
jargon.miscAvoiding miscellaneous jargon
lgbtq.offensive_termsAvoding offensive LGBTQ terms
lgbtq.termsMisused LGBTQ terms
lexical_illusions.miscAvoiding lexical illusions
links.brokenLinking only to existing sites
malapropisms.miscAvoiding common malapropisms
misc.apologizingBeing confident
misc.back_formationsAvoiding needless backformations
misc.bureaucrateseAvoiding bureaucratese
misc.butAvoid starting a paragraph with "But..."
misc.capitalizationCapitalizing only what ought to be capitalized
misc.chatspeakAvoiding lolling and other chatspeak
misc.commercialeseAvoiding jargon of the commercial world
misc.currencyAvoiding redundant currency symbols
misc.debasedAvoiding debased language
misc.false_pluralsAvoiding false plurals
misc.illogicAvoiding illogical forms
misc.inferior_superiorSuperior to, not than
misc.latinAvoiding overuse of Latin phrases
misc.many_aMany a singular
misc.metaconceptsAvoiding overuse of metaconcepts
misc.narcissismTalking about the subject, not its study
misc.phrasal_adjectivesHyphenating phrasal adjectives
misc.preferred_formsMiscellaneous preferred forms
misc.pretensionAvoiding being pretentious
misc.professionsCalling jobs by the right name
misc.punctuationUsing punctuation assiduously
misc.scare_quotesUsing scare quotes only when needed
misc.suddenlyAvoiding the word suddenly
misc.tense_presentAdvice from Tense Present
misc.waxedWaxing poetic
misc.whenceUsing "whence"
mixed_metaphors.miscNot mixing metaphors
mondegreens.miscAvoiding mondegreen
needless_variants.miscUsing the preferred form
nonwords.miscAvoid using nonwords
oxymorons.miscAvoiding oxymorons
psychology.miscAvoiding misused psychological terms
redundancy.miscAvoiding redundancy and saying things twice
redundancy.ras_syndromeAvoiding RAS syndrome
skunked_terms.miscAvoid using skunked terms
spelling.able_atable-able vs. -atable
spelling.able_ible-able vs. -ible
spelling.athletesSpelling of athlete names
spelling.em_im_en_in-em vs. -im and -en vs. -in
spelling.er_or-er vs. -or
spelling.in_unin- vs. un-
spelling.miscSpelling words correctly
security.credit_cardKeeping credit card numbers secret
security.passwordKeeping passwords secret
sexism.miscAvoiding sexist language
terms.animal_adjectivesAnimal adjectives
terms.denizen_labelsCalling denizens by the right name
terms.eponymous_adjectivesCalling people by the right name
terms.veneryCall groups of animals by the right name
typography.diacritical_marksUsing dïacríticâl marks
typography.exclamationAvoiding overuse of exclamation
typography.symbolsUsing the right symbols
uncomparables.miscNot comparing uncomparables
weasel_words.miscAvoiding weasel words
weasel_words.veryAvoiding the word "very"

Contributing

Interested in contributing to proselint? Great — there are plenty of ways you can help. Read more on our website, where we describe how you can help us build proselint into the greatest writing tool in the world.

Support

If you run into a problem, please open an issue in or send an email to hello@amperser.com.

Running Automated Tests

Automated tests are included in the proselint/tests directory. To run these tests locally, you can use ./utils.

License

The project is licensed under the BSD license.