| 1 |
"""Tense present. |
| 2 |
|
| 3 |
--- |
| 4 |
layout: post |
| 5 |
source: DFW's Tense Present |
| 6 |
source_url: http://bit.ly/1c85lgR |
| 7 |
title: Tense present |
| 8 |
date: 2014-06-10 12:31:19 |
| 9 |
categories: writing |
| 10 |
--- |
| 11 |
|
| 12 |
Archaism. |
| 13 |
|
| 14 |
""" |
| 15 |
import re |
| 16 |
|
| 17 |
from proselint.tools import memoize |
| 18 |
|
| 19 |
|
| 20 |
@memoize |
| 21 |
def check(text): |
| 22 |
"""Check the text.""" |
| 23 |
err = "misc.tense_present" |
| 24 |
msg = r"'{}'." |
| 25 |
|
| 26 |
illogics = [ |
| 27 |
r"up to \d{1,3}% ?[-\u2014\u2013]{0,3} ?(?:or|and) more\W?", |
| 28 |
"between you and I", |
| 29 |
"on accident", |
| 30 |
"somewhat of a", |
| 31 |
"all it's own", |
| 32 |
"reason is because", |
| 33 |
"audible to the ear", |
| 34 |
"in regards to", |
| 35 |
"would of", |
| 36 |
# "and so", |
| 37 |
r"i ?(?:feel|am feeling|am|'m|'m feeling) nauseous", |
| 38 |
] |
| 39 |
|
| 40 |
errors = [] |
| 41 |
for i in illogics: |
| 42 |
for m in re.finditer(fr"\s{i}\s", text, flags=re.U | re.I): |
| 43 |
txt = m.group(0).strip() |
| 44 |
errors.append(( |
| 45 |
m.start() + 1, |
| 46 |
m.end(), |
| 47 |
err, |
| 48 |
msg.format(txt), |
| 49 |
None)) |
| 50 |
|
| 51 |
return errors |