当前位置: 首页>>代码示例>>Python>>正文


Python tools.existence_check函数代码示例

本文整理汇总了Python中tools.existence_check函数的典型用法代码示例。如果您正苦于以下问题:Python existence_check函数的具体用法?Python existence_check怎么用?Python existence_check使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了existence_check函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: check_midnight_noon

def check_midnight_noon(text):
    """Check the text."""
    err = "garner.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)
开发者ID:Uran198,项目名称:proselint,代码行数:7,代码来源:am_pm.py

示例2: check_copyright_symbol

def check_copyright_symbol(text):
    """Use the copyright symbol instead of (c)."""
    err = "butterick.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)
开发者ID:Uran198,项目名称:proselint,代码行数:7,代码来源:symbols.py

示例3: check

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)
开发者ID:ComSecNinja,项目名称:proselint,代码行数:32,代码来源:chatspeak.py

示例4: check_registered_trademark_symbol

def check_registered_trademark_symbol(text):
    """Use the registered trademark symbol instead of (R)."""
    err = "butterick.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)
开发者ID:Uran198,项目名称:proselint,代码行数:7,代码来源:symbols.py

示例5: check

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)
开发者ID:ComSecNinja,项目名称:proselint,代码行数:30,代码来源:oxymorons.py

示例6: check_repeated_exclamations

def check_repeated_exclamations(text):
    """Check the text."""
    err = "inc.corporate_speak"
    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)
开发者ID:ComSecNinja,项目名称:proselint,代码行数:34,代码来源:corporate_speak.py

示例7: check_sentence_spacing

def check_sentence_spacing(text):
    """Use no more than two spaces after a period."""
    err = "butterick.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)
开发者ID:Uran198,项目名称:proselint,代码行数:7,代码来源:symbols.py

示例8: check_ellipsis

def check_ellipsis(text):
    """Use an ellipsis instead of three dots."""
    err = "butterick.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)
开发者ID:Uran198,项目名称:proselint,代码行数:7,代码来源:symbols.py

示例9: check

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)
开发者ID:Uran198,项目名称:proselint,代码行数:35,代码来源:commercialese.py

示例10: check_multiplication_symbol

def check_multiplication_symbol(text):
    u"""Use the multiplication symbol ×, not the lowercase letter x."""
    err = "butterick.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)
开发者ID:decorator1991,项目名称:proselint,代码行数:8,代码来源:symbols.py

示例11: check_ly

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)
开发者ID:TimBuckley,项目名称:proselint,代码行数:8,代码来源:phrasal_adjectives.py

示例12: check_without_your_collusion

def check_without_your_collusion(text):
    """Check the textself."""
    err = "garner.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)
开发者ID:Uran198,项目名称:proselint,代码行数:8,代码来源:illogic.py

示例13: check_coin_a_phrase_from

def check_coin_a_phrase_from(text):
    """Check the text."""
    err = "garner.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)
开发者ID:Uran198,项目名称:proselint,代码行数:8,代码来源:illogic.py

示例14: check_ellipsis

def check_ellipsis(text):
    """Use an ellipsis instead of three dots."""
    err = "palahniuk.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)
开发者ID:ComSecNinja,项目名称:proselint,代码行数:8,代码来源:suddenly.py

示例15: check

def check(text):
    """Suggest the preferred forms."""
    err = "pinker.hedging"
    msg = "Hedging. Just say it."

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

    return existence_check(text, narcisissm, err, msg)
开发者ID:Uran198,项目名称:proselint,代码行数:8,代码来源:hedging.py


注:本文中的tools.existence_check函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。