| 1 |
"""Too much yelling. |
| 2 |
|
| 3 |
--- |
| 4 |
layout: post |
| 5 |
source: ??? |
| 6 |
source_url: ??? |
| 7 |
title: yelling |
| 8 |
date: 2014-06-10 12:31:19 |
| 9 |
categories: writing |
| 10 |
--- |
| 11 |
|
| 12 |
Too much yelling. |
| 13 |
|
| 14 |
""" |
| 15 |
from proselint.tools import existence_check, max_errors, memoize, ppm_threshold |
| 16 |
|
| 17 |
|
| 18 |
@max_errors(1) |
| 19 |
@memoize |
| 20 |
def check_repeated_exclamations(text): |
| 21 |
"""Check the text.""" |
| 22 |
err = "leonard.exclamation.multiple" |
| 23 |
msg = "Stop yelling. Keep your exclamation points under control." |
| 24 |
|
| 25 |
regex = r"[\!]\s*?[\!]{1,}" |
| 26 |
|
| 27 |
return existence_check(text, [regex], err, msg, require_padding=False, |
| 28 |
ignore_case=False, dotall=True) |
| 29 |
|
| 30 |
|
| 31 |
@ppm_threshold(30) |
| 32 |
@memoize |
| 33 |
def check_exclamations_ppm(text): |
| 34 |
"""Make sure that the exclamation ppm is under 30.""" |
| 35 |
err = "leonard.exclamation.30ppm" |
| 36 |
msg = "More than 30 ppm of exclamations. Keep them under control." |
| 37 |
|
| 38 |
regex = r"\w!" |
| 39 |
|
| 40 |
return existence_check(text, [regex], err, msg, require_padding=False) |