Skip to content

Commit e65fddb

Browse files
committed
feat: use least as indicator
1 parent f549c5b commit e65fddb

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

proselint/checks/uncomparables.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@
5151

5252
from proselint.registry.checks import Check, CheckResult, types
5353

54-
POSSIBLE_PATTERN = r"possible(?!\s*\?)"
55-
5654
COMPARATORS = (
5755
"most",
5856
"more",
@@ -89,7 +87,7 @@
8987
"paramount",
9088
"perfect",
9189
"perpetual",
92-
POSSIBLE_PATTERN,
90+
"possible",
9391
"preferable",
9492
"principal",
9593
"singular",
@@ -107,17 +105,21 @@
107105
)
108106
EXCEPTIONS = (
109107
("more", "perfect"),
110-
("more", POSSIBLE_PATTERN),
108+
("more", "possible"),
111109
)
112110

113111

114112
def _check_uncomparables(text: str, check: Check) -> Iterator[CheckResult]:
115-
"""Check the text."""
113+
"""Check the text for uncomparables."""
116114
return types.Existence(
117115
items=tuple(
118-
rf"{pair[0]}\s{pair[1]}"
119-
for pair in product(COMPARATORS, UNCOMPARABLES)
120-
if pair not in EXCEPTIONS
116+
(
117+
rf"(?<!at\s)\bleast\s+{adj}\b"
118+
if comp == "least"
119+
else rf"\b{comp}\s+{adj}\b"
120+
)
121+
for comp, adj in product(COMPARATORS, UNCOMPARABLES)
122+
if (comp, adj) not in EXCEPTIONS
121123
)
122124
).check(text, check)
123125

tests/examples.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,16 @@
111111
"A more perfect union.",
112112
"A more possible future.",
113113
"But is it at least possible?",
114+
"It's at least possible for that thing to exist",
115+
(
116+
"It is at least possible of achievement and that our actions"
117+
"are at least possible contributions to bringing it about."
118+
),
119+
(
120+
"It should be at least possible for the Department to improve"
121+
"its position and for the citizens generally to"
122+
"enjoy prosperity."
123+
),
114124
),
115125
),
116126
(

0 commit comments

Comments
 (0)