Skip to content

Commit

Permalink
Reorganize MAU rules
Browse files Browse the repository at this point in the history
  • Loading branch information
laraross committed Sep 28, 2015
1 parent 78b2912 commit c5c5916
Show file tree
Hide file tree
Showing 10 changed files with 132 additions and 156 deletions.
19 changes: 0 additions & 19 deletions proselint/checks/mau_abbetor.py

This file was deleted.

19 changes: 0 additions & 19 deletions proselint/checks/mau_abbreviable.py

This file was deleted.

25 changes: 0 additions & 25 deletions proselint/checks/mau_academically.py

This file was deleted.

19 changes: 0 additions & 19 deletions proselint/checks/mau_acquirer.py

This file was deleted.

19 changes: 0 additions & 19 deletions proselint/checks/mau_addable.py

This file was deleted.

19 changes: 0 additions & 19 deletions proselint/checks/mau_adducible.py

This file was deleted.

83 changes: 83 additions & 0 deletions proselint/checks/mau_preferred_forms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# -*- coding: utf-8 -*-
"""MAU102: Preferred forms, needless variants.
---
layout: post
error_code: MAU102
source: Garner's Modern American Usage
source_url: http://amzn.to/15wF76r
title: abbetor
date: 2014-06-10 12:31:19
categories: writing
---
Points out use of needless variants and less preferred forms.
"""
import re


def check(text):
"""Suggest the preferred forms."""
err = "MAU102"
msg = "{} is the preferred form."

preferences = [

# Needless variants
["abbreviable", ["abbreviatable"]],
["abolition", ["abolishment"]],
["accessory", ["accessary"]],
["accrual", ["accruement"]],
["accumulate", ["cumulate"]],
["accused", ["accusee"]],
["acquaintance", ["acquaintanceship"]],
["acquittal", ["acquitment"]],
["administer", ["administrate"]],
["administered", ["administrated"]],
["administering", ["administrating"]],
["adulterous", ["adulterate"]],
["advisory", ["advisatory"]],
["advocate", ["advocator"]],
["alleger", ["allegator"]],
["allusive", ["allusory"]],
["ameliorate", ["meliorate"]],
["amorous", ["amative"]],
["amortization", ["amortizement"]],
["amphibology", ["amphiboly"]],
["anachronism", ["parachronism"]],
["anecdotist", ["anecdotalist"]],
["anilingus", ["anilinctus"]],
["anticipatory", ["anticipative"]],
["convertible", ["conversible"]],
["neglectful", ["neglective"]],
["transposition", ["transposal"]],

# Misc. misspellings
["academically", ["academicly"]],
["anilingus", ["analingus"]],

# Hyphenated words
["tortfeasor", ["tort feasor", "tort-feasor"]],
["transship", ["tranship", "trans-ship"]],
["transshipped", ["transhipped", "trans-shipped"]],
["transshipping", ["transhipping", "trans-shipping"]],

# able vs. ible
["addable", ["addible"]],
["adducible", ["adduceable"]],

# er vs. or
["abettor", ["abbeter"]],
["acquirer", ["acquiror"]],

# TODO, entries that are a bit complicated
# announce
]
errors = []
for p in preferences:
for r in p[1]:
for m in re.finditer(r, text, flags=re.IGNORECASE):
errors.append((m.start(), m.end(), err, msg.format(p[0])))

return errors
49 changes: 49 additions & 0 deletions proselint/checks/mau_redundancy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# -*- coding: utf-8 -*-
"""MAU103: Redundancy.
---
layout: post
error_code: MAU103
source: Garner's Modern American Usage
source_url: http://amzn.to/15wF76r
title: abbetor
date: 2014-06-10 12:31:19
categories: writing
---
Points out use redundant phrases.
"""
import re


def check(text):
"""Suggest the preferred forms."""
err = "MAU103"
msg = "'{}' is redundant, try '{}'."

redundancies = [
["antithetical", ["directly antithetical"]],
["ATM", ["ATM machine"]],
["approximately", ["approximately about"]],
["associate", ["associate together"]],
["associate", ["associate together in groups"]],
["vocation", ["professional vocation"]],
["bivouac", ["temporary bivouac", "bivouac camp"]],
["obvious", ["blatantly obvious"]],
["but", ["but nevertheless"]],
["charged with ...", ["accused of a charge"]],
["circumstances", ["surrounding circumstances"]],
["circumstances of", ["circumstances surrounding"]],
["close", ["close proximity"]],
["collaborator", ["fellow collaborator"]],
["collaborators", ["fellow collaborators"]]
]

errors = []
for p in redundancies:
for r in p[1]:
for m in re.finditer(r, text, flags=re.IGNORECASE):
errors.append((m.start(), m.end(), err, msg.format(r, p[0])))

return errors
22 changes: 0 additions & 22 deletions proselint/checks/mau_tortfeasor.py

This file was deleted.

14 changes: 0 additions & 14 deletions proselint/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,6 @@
import shelve
import inspect
import functools
import re


def supersede(new, old, error_code):
"""Replace one word with another."""
def check(text):
msg = "It's '{}', not '{}'.".format(new, old)
errors = []
for m in re.finditer(old, text, flags=re.IGNORECASE):
errors.append((m.start(), m.end(), error_code, msg))

return errors

return check


def memoize(f):
Expand Down

0 comments on commit c5c5916

Please sign in to comment.