Esempio n. 1
0
def check(text):
    """Check the text."""
    err = "misc.chatspeak"
    msg = u"'{}' is chatspeak. Write it out."

    words = [
        "2day",
        "4U",
        "AFAIK",
        "AFK",
        "AFK",
        "ASAP",
        "B4",
        "brb",
        "btw",
        "cya",
        "GR8",
        "lol",
        "LOL",
        "LUV",
        "OMG",
        "rofl",
        "roftl",
        "sum1",
        "SWAK",
        "THNX",
        "THX",
        "TTYL",
        "XOXO"
    ]

    return existence_check(text, words, err, msg)
Esempio n. 2
0
def check(text):
    """Check the text."""
    err = "misc.not_guilty"
    msg = u"'not guilty beyond a reasonable doubt' is an ambiguous phrasing."
    regex = r"not guilty beyond (a |any )?reasonable doubt"

    return existence_check(text, [regex], err, msg)
Esempio n. 3
0
def check_decade_apostrophes_long(text):
    """Check the text for dates of the form XXX0's."""
    err = "dates_times.dates"
    msg = u"Apostrophes aren't needed for decades."

    regex = "\d\d\d0\'s"
    return existence_check(text, [regex], err, msg)
Esempio n. 4
0
def check_dash_and_from(text):
    """Check the text."""
    err = "dates_times.dates"
    msg = u"When specifying a date range, write 'from X to Y'."

    regex = "[fF]rom \d+[^ \t\n\r\f\va-zA-Z0-9_\.]\d+"
    return existence_check(text, [regex], err, msg)
Esempio n. 5
0
def check_month_year_comma(text):
    """Check the text."""
    err = "dates_times.dates"
    msg = u"When specifying a month and year, no comma is needed."

    regex = "(?:" + "|".join(calendar.month_name[1:]) + "), \d{3,}"
    return existence_check(text, [regex], err, msg)
Esempio n. 6
0
def check_midnight_noon(text):
    """Check the text."""
    err = "dates_times.am_pm.midnight_noon"
    msg = (u"12 a.m. and 12 p.m. are wrong and confusing."
           " Use 'midnight' or 'noon'.")

    return existence_check(text, ["12 ?[ap]\.?m\.?"], err, msg)
Esempio n. 7
0
def check(text):
    """Check the text."""
    err = "corporate_speak.misc"
    msg = u"Minimize your use of corporate catchphrases like this one."

    list = [
        "at the end of the day",
        "back to the drawing board",
        "hit the ground running",
        "get the ball rolling",
        "low-hanging fruit",
        "thrown under the bus",
        "think outside the box",
        "let's touch base",
        "get my manager's blessing",
        "it's on my radar",
        "ping me",
        "i don't have the bandwidth",
        "no brainer",
        "par for the course",
        "bang for your buck",
        "synergy",
        "move the goal post",
        "apples to apples",
        "win-win",
        "circle back around",
        "all hands on deck",
        "take this offline",
        "drill-down",
        "elephant in the room",
        "on my plate",
    ]

    return existence_check(text, list, err, msg, ignore_case=True)
Esempio n. 8
0
def check(text):
    """Check the text."""
    err = "garner.commercialese"
    msg = u"'{}' is commercialese."

    commercialese = [
        "acknowledging yours of",
        "beg to advise",
        "enclosed herewith",
        "enclosed please find",
        "further to yours of",
        "further to your letter",
        "in regard to",
        "inst\.",
        "in the amount of",
        "of even date",
        "pending receipt of",
        "please be advised that",
        "please return same",
        "pleasure of a reply",
        "prox\.",
        "pursuant to your request",
        "regarding the matter",
        "regret to inform",
        "thanking you in advance",
        "the undersigned",
        "this acknowledges your letter",
        "ult\."
        "we are pleased to note",
        "with regard to",
        "your favor has come to hand",
        "yours of even date"
    ]

    return existence_check(text, commercialese, err, msg, join=True)
Esempio n. 9
0
def check(text):
    """Check the text."""
    err = "garner.oxymorons"
    msg = u"'{}' is an oxymoron."

    oxymorons = [
        "amateur expert",
        "increasingly less",
        "advancing backwards?",
        "alludes explicitly to",
        "explicitly alludes to",
        "totally obsolescent",
        "completely obsolescent",
        "generally always",
        "usually always",
        "increasingly less",
        "build down",
        "conspicuous absence",
        "exact estimate",
        "executive secretary",
        "found missing",
        "intense apathy",
        "mandatory choice",
        "nonworking mother",
        "organized mess",
        # "pretty ugly",
        # "sure bet",
    ]

    return existence_check(text, oxymorons, err, msg, offset=1, join=True)
Esempio n. 10
0
def check_month_of_year(text):
    """Check the text."""
    err = "dates_times.dates"
    msg = u"When specifying a month and year, 'of' is unnecessary."

    regex = "(?:" + "|".join(calendar.month_name[1:]) + ") of \d{3,}"
    return existence_check(text, [regex], err, msg)
Esempio n. 11
0
def check_ly(text):
    """Check the text."""
    err = "garner.phrasal_adjectives.ly"
    msg = u"""No hyphen is necessary in phrasal adjectives with an adverb
              ending in -ly."""

    return existence_check(text, ["ly-"], err, msg,
                           require_padding=False, offset=-1)
Esempio n. 12
0
def check(text):
    """Suggest the preferred forms."""
    err = "pinker.narcisissm"
    msg = "Professional narcisissm. Talk about the subject, not its study."

    narcisissm = ["In recent years, an increasing number of [a-zA-Z]{3,}sts have"]

    return existence_check(text, narcisissm, err, msg)
Esempio n. 13
0
def check_repeated_exclamations(text):
    """Check the text."""
    err = "leonard.exclamation.multiple"
    msg = u"Stop yelling. Keep your exclamation points under control."

    regex = r"[^A-Z]\b((\s[A-Z]+){3,})"

    return existence_check(text, [regex], err, msg, require_padding=False, ignore_case=False, max_errors=1, dotall=True)
Esempio n. 14
0
def check_ellipsis(text):
    """Use an ellipsis instead of three dots."""
    err = "misc.suddenly"
    msg = u"Suddenly is nondescript, slows the action, and warns your reader."
    regex = "Suddenly,"

    return existence_check(text, [regex], err, msg, max_errors=3,
                           require_padding=False, offset=-1, ignore_case=False)
Esempio n. 15
0
def check(text):
    """Check the text."""
    err = "malapropisms.misc"
    msg = u"'{}' is a malapropism."

    illogics = ["the infinitesimal universe", "a serial experience", "attack my voracity"]

    return existence_check(text, illogics, err, msg, offset=1)
Esempio n. 16
0
def check(text):
    """Advice on sudden vs suddenly."""
    err = "misc.suddenly"
    msg = u"Suddenly is nondescript, slows the action, and warns your reader."
    regex = "Suddenly,"

    return existence_check(text, [regex], err, msg, max_errors=3,
                           require_padding=False, offset=-1, ignore_case=False)
Esempio n. 17
0
def check_trademark_symbol(text):
    """Use the trademark symbol instead of (TM)."""
    err = "butterick.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)
Esempio n. 18
0
def check_ellipsis(text):
    """Use an ellipsis instead of three dots."""
    err = "typography.symbols.ellipsis"
    msg = u"'...' is an approximation, use the ellipsis symbol '…'."
    regex = "\.\.\."

    return existence_check(text, [regex], err, msg, max_errors=3,
                           require_padding=False, offset=0)
Esempio n. 19
0
def check(text):
    """Check the text."""
    err = "airlinese.misc"
    msg = u"'{}' is airlinese."

    airlinese = ["enplan(?:e|ed|ing|ement)", "deplan(?:e|ed|ing|ement)", "taking off momentarily"]

    return existence_check(text, airlinese, err, msg)
Esempio n. 20
0
def check_registered_trademark_symbol(text):
    """Use the registered trademark symbol instead of (R)."""
    err = "typography.symbols.trademark"
    msg = u"(R) is a goofy alphabetic approximation, use the symbol ®."
    regex = "\([rR]\)"

    return existence_check(
        text, [regex], err, msg, max_errors=3, require_padding=False)
Esempio n. 21
0
def check_copyright_symbol(text):
    """Use the copyright symbol instead of (c)."""
    err = "typography.symbols.copyright"
    msg = u"(c) is a goofy alphabetic approximation, use the symbol ©."
    regex = "\([cC]\)"

    return existence_check(
        text, [regex], err, msg, max_errors=1, require_padding=False)
Esempio n. 22
0
def check_sentence_spacing(text):
    """Use no more than two spaces after a period."""
    err = "typography.symbols.sentence_spacing"
    msg = u"More than two spaces after the period; use 1 or 2."
    regex = "\. {3}"

    return existence_check(
        text, [regex], err, msg, max_errors=3, require_padding=False)
Esempio n. 23
0
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)
Esempio n. 24
0
def check(text):
    """Suggest the preferred forms."""
    err = "pinker.apologizing"
    msg = "Excessive apologizing."

    narcisissm = ["More research is needed"]

    return existence_check(text, narcisissm, err, msg)
Esempio n. 25
0
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)
Esempio n. 26
0
def check(text):
    """Avoid 'very'."""
    err = "weasel_words.very"
    msg = ("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.")
    regex = "very"

    return existence_check(text, [regex], err, msg, max_errors=1)
Esempio n. 27
0
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)
Esempio n. 28
0
def check_repeated_exclamations(text):
    """Check the text."""
    err = "leonard.hell"
    msg = u"Never use the words 'all hell broke loose'."

    regex = r"all hell broke loose"

    return existence_check(
        text, [regex], err, msg, max_errors=1)
Esempio n. 29
0
def check_decade_apostrophes_short(text):
    """Check the text for dates of the form X0's."""
    err = "dates_times.dates"
    msg = u"Apostrophes aren't needed for decades."

    regex = "\d0\'s"

    return existence_check(
        text, [regex], err, msg, excluded_topics=["50 Cent"])
Esempio n. 30
0
def check_debased_language(text):
    """Check the text."""
    err = "cursing.filth"
    msg = u"""Nobody ever tells you this as a kid, but you're supposed to avoid
        this word."""

    list = ["shit", "piss", "f**k", "c**t", "c********r", "m**********r", "t**s", "fart", "turd", "twat"]

    return existence_check(text, list, err, msg)
Esempio n. 31
0
def check_et_al(text):
    """Check the text."""
    err = "garner.punctuation"
    msg = u"Misplaced punctuation. It's 'et al.'"

    list = [
        "et. al",
        "et. al."
    ]
    return existence_check(text, list, err, msg, join=True)
Esempio n. 32
0
def check(text):
    """Suggest the preferred forms."""
    err = "pinker.narcissism"
    msg = "Professional narcissism. Talk about the subject, not its study."

    narcissism = [
        "In recent years, an increasing number of [a-zA-Z]{3,}sts have",
    ]

    return existence_check(text, narcissism, err, msg)
Esempio n. 33
0
def check(text):
    """Check for constructs that may signal passive voice."""
    err = "passive_voice.misc"
    msg = u"This seems to be in passive voice. Consider using active voice."
    list = [(r"\b(?:be|is|am|are|was|were|have|has|had|get|got)"
             r"\b[\w\s]{0,28}(?:d|(?<!whe)|ne?|left|being|made)"
             r"\b(?:by)\b"),
            r"let(\b[\w\s]+\b){4,}?be"]

    return existence_check(text, list, err, msg)
Esempio n. 34
0
def check_repeated_exclamations(text):
    """Check the text."""
    err = "skekely.nword"
    msg = u"Take responsibility for the shitty words you want to say."

    list = [
        "the n-word",
    ]

    return existence_check(text, list, err, msg)
Esempio n. 35
0
def check(text):
    """Suggest the preferred forms."""
    err = "pinker.scare_quotes"
    msg = "Misuse of 'scare quotes'. Delete them."

    narcissism = [
        "the 'take-home message'",
    ]

    return existence_check(text, narcissism, err, msg)
Esempio n. 36
0
def check(text):
    """Suggest the preferred forms."""
    err = "pinker.apologizing"
    msg = "Excessive apologizing."

    narcisissm = [
        "More research is needed",
    ]

    return existence_check(text, narcisissm, err, msg)
Esempio n. 37
0
def check(text):
    """Check the text."""
    err = "cursing.nword"
    msg = u"Take responsibility for the shitty words you want to say."

    list = [
        "the n-word",
    ]

    return existence_check(text, list, err, msg)
Esempio n. 38
0
def check_repeated_exclamations(text):
    """Check the text."""
    err = "leonard.exclamation.multiple"
    msg = u"Stop yelling. Keep your exclamation points under control."

    regex = r"[^A-Z]\b((\s[A-Z]+){3,})"

    return existence_check(
        text, [regex], err, msg, require_padding=False, ignore_case=False,
        max_errors=1, dotall=True)
Esempio n. 39
0
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)
Esempio n. 40
0
def check_sentence_spacing(text):
    """Use no more than two spaces after a period."""
    err = "typography.symbols.sentence_spacing"
    msg = u"More than two spaces after the period; use 1 or 2."
    regex = "\. {3}"

    return existence_check(text, [regex],
                           err,
                           msg,
                           max_errors=3,
                           require_padding=False)
def check_ly(text):
    """Check the text."""
    err = "garner.phrasal_adjectives.ly"
    msg = u"""No hyphen is necessary in phrasal adjectives with an adverb
              ending in -ly, unless the -ly adverb is part of a longer
              phrase"""

    regex = "\s[^\s-]+ly-"

    return existence_check(text, [regex], err, msg,
                           require_padding=False, offset=-1)
Esempio n. 42
0
def check_copyright_symbol(text):
    """Use the copyright symbol instead of (c)."""
    err = "typography.symbols.copyright"
    msg = u"(c) is a goofy alphabetic approximation, use the symbol ©."
    regex = "\([cC]\)"

    return existence_check(text, [regex],
                           err,
                           msg,
                           max_errors=1,
                           require_padding=False)
Esempio n. 43
0
def check(text):
    """Check the text."""
    err = "hyperbolic.misc"
    msg = u"'{}' is hyperbolic."

    words = [
        r"[a-z]*[!]{2,}",
        r"[a-z]*\?{2,}"
    ]

    return existence_check(text, words, err, msg)
Esempio n. 44
0
def check_decade_apostrophes_short(text):
    """Check the text for dates of the form X0's."""
    err = "garner.dates"
    msg = u"Apostrophes aren't needed for decades."

    regex = "\d0\'s"

    return existence_check(text, [regex],
                           err,
                           msg,
                           excluded_topics=["50 Cent"])
Esempio n. 45
0
def check_same(text):
    """Check Impersonal pronoun same."""
    err = "style-guide.check-same"
    msg = "Avoid using \"The same\"."
    regex = "\. The same"

    return existence_check(text, [regex],
                           err,
                           msg,
                           ignore_case=False,
                           require_padding=False)
Esempio n. 46
0
def check_ly(text):
    """Check the text."""
    err = "garner.phrasal_adjectives.ly"
    msg = u"""No hyphen is necessary in phrasal adjectives with an adverb
              ending in -ly."""

    return existence_check(text, ["ly-"],
                           err,
                           msg,
                           require_padding=False,
                           offset=-1)
Esempio n. 47
0
def check(text):
    """Check the text."""
    err = "garner.bureaucratese"
    msg = u"'{}' is bureaucratese."

    bureaucratese = [
        "meet with your approval",
        "meets with your approval",
    ]

    return existence_check(text, bureaucratese, err, msg, join=True)
Esempio n. 48
0
def check_registered_trademark_symbol(text):
    """Use the registered trademark symbol instead of (R)."""
    err = "typography.symbols.trademark"
    msg = u"(R) is a goofy alphabetic approximation, use the symbol ®."
    regex = "\([rR]\)"

    return existence_check(text, [regex],
                           err,
                           msg,
                           max_errors=3,
                           require_padding=False)
Esempio n. 49
0
def check_trademark_symbol(text):
    """Use the trademark symbol instead of (TM)."""
    err = "butterick.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)
Esempio n. 50
0
def check_curly_quotes(text):
    u"""Use curly quotes, not straight quotes."""
    err = "typography.symbols.curly_quotes"
    msg = u'Use curly quotes “”, not straight quotes "".'
    regex = r"\"[\w\s\d]+\""

    return existence_check(text, [regex],
                           err,
                           msg,
                           max_errors=3,
                           require_padding=False)
Esempio n. 51
0
def check(text):
    """Check the text."""
    err = "lexical_illusions.misc"
    msg = "There's a lexical illusion here: a word is repeated."
    regex = r"\b(\w+)(\b\s\1)+\b"
    exceptions = [r"^had had$", r"^that that$"]

    return existence_check(text, [regex],
                           err,
                           msg,
                           exceptions=exceptions,
                           require_padding=False)
Esempio n. 52
0
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)
Esempio n. 53
0
def check(text):
    """Check the text."""
    err = "malapropisms.misc"
    msg = "'{}' is a malapropism."

    illogics = [
        "the infinitesimal universe",
        "a serial experience",
        "attack my voracity",
    ]

    return existence_check(text, illogics, err, msg, offset=1)
Esempio n. 54
0
def check_ellipsis(text):
    """Use an ellipsis instead of three dots."""
    err = "typography.symbols.ellipsis"
    msg = u"'...' is an approximation, use the ellipsis symbol '…'."
    regex = "\.\.\."

    return existence_check(text, [regex],
                           err,
                           msg,
                           max_errors=3,
                           require_padding=False,
                           offset=0)
Esempio n. 55
0
def check(text):
    """Check the text."""
    err = "misc.chatspeak"
    msg = "'{}' is chatspeak. Write it out."

    words = [
        "2day", "4U", "AFAIK", "AFK", "AFK", "ASAP", "B4", "brb", "btw", "cya",
        "GR8", "lol", "LOL", "LUV", "OMG", "rofl", "roftl", "sum1", "SWAK",
        "THNX", "THX", "TTYL", "XOXO"
    ]

    return existence_check(text, words, err, msg)
Esempio n. 56
0
def check(text):
    """Check the text."""
    err = "airlinese.misc"
    msg = u"'{}' is airlinese."

    airlinese = [
        "enplan(?:e|ed|ing|ement)",
        "deplan(?:e|ed|ing|ement)",
        "taking off momentarily",
    ]

    return existence_check(text, airlinese, err, msg)
Esempio n. 57
0
def check_p_equals_zero(text):
    """Check for p = 0.000."""
    err = "psychology.p_equals_zero"
    msg = "Unless p really equals zero, you should use more decimal places."

    list = [
        "p = 0.00",
        "p = 0.000",
        "p = 0.0000",
    ]

    return existence_check(text, list, err, msg, join=True)
Esempio n. 58
0
def check(text):
    """Suggest the preferred forms."""
    err = "hedging.misc"
    msg = "Hedging. Just say it."

    narcissism = [
        "I would argue that",
        ", so to speak",
        "to a certain degree",
    ]

    return existence_check(text, narcissism, err, msg)
Esempio n. 59
0
def check(text):
    """Advice on sudden vs suddenly."""
    err = "misc.suddenly"
    msg = u"Suddenly is nondescript, slows the action, and warns your reader."
    regex = "Suddenly,"

    return existence_check(text, [regex],
                           err,
                           msg,
                           max_errors=3,
                           require_padding=False,
                           offset=-1,
                           ignore_case=False)
Esempio n. 60
0
def check(text):
    """Check the text."""
    err = "misc.debased"
    msg = "Bad usage, debased language, a continuous temptation."

    list = [
        "a not unjustifiable assumption",
        "leaves much to be desired",
        "would serve no purpose",
        "a consideration which we should do well to bear in mind",
    ]

    return existence_check(text, list, err, msg)