Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@memoize
def check(text):
"""Suggest the preferred forms."""
err = "garner.nonwords"
msg = "Nonword, try '{}'."
preferences = [
["doubtless' or 'undoubtedly", ["doubtlessly"]],
["analysis", ["analyzation"]],
["annoyance", ["annoyment"]],
["confirmand", ["confirmant"]],
["confirmands", ["confirmants"]],
["converse", ["conversate"]],
["cranded", ["crained"]],
["disbursement' or 'dispersal", ["dispersement"]],
["discomfort' or 'discomfiture", ["discomforture"]],
@memoize
def check_without_your_collusion(text):
"""Check the textself."""
err = "misc.illogic.collusion"
msg = "It's impossible to defraud yourself. Try 'aquiescence'."
regex = "without your collusion"
return existence_check(
text, [regex], err, msg, require_padding=False, offset=-1)
@memoize
def check(text):
"""Suggest the preferred forms."""
err = "misc.many_a"
msg = "'many a' requires a singular verb."
preferences = [
["is many a", ["are many a"]],
["has been many a", ["have been many a"]],
["was many a", ["were many a"]],
]
return preferred_forms_check(text, preferences, err, msg)
@memoize
def check_trademark_symbol(text):
"""Use the trademark symbol instead of (TM)."""
err = "typography.symbols.trademark"
msg = u"(TM) is a goofy alphabetic approximation, use the symbol ™."
regex = "\(TM\)"
return existence_check(
text, [regex], err, msg, max_errors=3, require_padding=False)
@memoize
def check(text):
"""Suggest the preferred forms."""
err = "misc.inferior_superior"
msg = "'Inferior' and 'superior' are not true comparatives. Use '{}'."
preferences = [
["inferior to", ["inferior than"]],
["superior to", ["superior than"]],
]
return preferred_forms_check(text, preferences, err, msg)
@memoize
def check_coin_a_phrase_from(text):
"""Check the text."""
err = "misc.illogic.coin"
msg = "You can't coin an existing phrase. Did you mean 'borrow'?"
regex = "to coin a phrase from"
return existence_check(text, [regex], err, msg, offset=1)
@memoize
def check(text):
"""Suggest the preferred forms."""
err = "groups"
msg = "You can use '{}' instead of the generic grouping used in '{}'."
terms = ["group", "bunch"]
preferences = [
# People
["blush", make_list(terms=terms, group="{} of boys")],
["drunkship", make_list(terms=terms, group="{} of cobblers")],
["hastiness", make_list(terms=terms, group="{} of cooks")],
["stalk", make_list(terms=terms, group="{} of foresters")],
["observance", make_list(terms=terms, group="{} of hermits")],
["bevy", make_list(terms=terms, group="{} of ladies")],
["faith", make_list(terms=terms, group="{} of merchants")],
["superfluity", make_list(terms=terms, group="{} of nuns")],
@memoize
def check_multiplication_symbol(text):
u"""Use the multiplication symbol ×, not the lowercase letter x."""
err = "typography.symbols.multiplication_symbol"
msg = u"Use the multiplication symbol ×, not the letter x."
regex = "[0-9]+ ?x ?[0-9]+"
return existence_check(
text, [regex], err, msg, max_errors=3, require_padding=False)
@memoize
def check(text):
"""em- vs. en-, im- vs. in-."""
err = "spelling.em_im_en_in"
msg = "em-, im-, en-, and in-. '{}' is the preferred spelling."
preferences = [
["embalm", ["imbalm"]],
["embark", ["imbark"]],
["embed", ["imbed"]],
["embitter", ["imbitter"]],
["emblaze", ["imblaze"]],
["embody", ["imbody"]],
["embolden", ["imbolden"]],
["embosom", ["imbosom"]],
["embower", ["imbower"]],
@memoize
def check_biggest_bottleneck(text):
"""Avoid mixing metaphors."""
err = "gowers.mixed_metaphors"
msg = "Mixed metaphor: bottles with big necks are easy to pass through."
list = [
"biggest bottleneck",
"big bottleneck",
"large bottleneck",
"largest bottleneck",
"world-wide bottleneck",
"huge bottleneck",
"massive bottleneck",
]
return existence_check(text, list, err, msg, max_errors=1)