proselint icon indicating copy to clipboard operation
proselint copied to clipboard

Simple regex checker for passive voice constructions

Open RyanMcCarl opened this issue 6 years ago • 8 comments

This is my first attempt to contribute, so please let me know if I need to do anything differently -- e.g. register the check with the application.

I haven't tested the regex extensively, but it performed well on this list.

Here are the results on Pythex:

Passive voice regex test 2018-06-12.pdf

Here is the regex itself -- I'm sure it can be improved, modularized into several regexes, etc. Happy to continue working on it when I can if you like the idea.

(\b(?:be|am|is|are|was|were|have|has|had)\b[\w\s]{,15}?(?:d|(?<!whe)n|ne|left|being)\b(?: by\b)?)

RyanMcCarl avatar Jun 13 '18 06:06 RyanMcCarl

I'm having trouble getting this through the checks even after rebasing the repository. Can anyone tell me what I'm doing wrong? @mpacer @suchow

RyanMcCarl avatar Jul 10 '18 19:07 RyanMcCarl

It seems that for the most part this PR is, well, broken. Its contents appear to be lost in over 372 changed files. Using regexes to hack together a passive voice check also doesn't seem ideal.

With that being said, I think we'll have to close this, unless you're available to work on it @RyanMcCarl.

Nytelife26 avatar May 24 '21 09:05 Nytelife26

@Nytelife26 Even if Ryan can’t work on this, it’s worth salvaging what we can from the PR. There are new modules buried in here based on Ryan’s professional expertise (he’s a lawyer and scholar who has taught advanced legal writing courses and does research on use of A.I. in law).

suchow avatar May 24 '21 21:05 suchow

In particular, see proselint/checks/mccarl/rm_style_pref_forms.py

suchow avatar May 24 '21 21:05 suchow

Ah, I see. I may have to root through the diffs and cherry-pick useful files, then - I didn't have time to review them all due to the mostly broken structure and the number of file changes.

I'll take a look now, though.

Nytelife26 avatar May 24 '21 22:05 Nytelife26

Codecov Report

Merging #802 (7ada6b8) into main (f8928ad) will increase coverage by 0.03%. The diff coverage is 100.00%.

:exclamation: Current head 7ada6b8 differs from pull request most recent head b48ea45. Consider uploading reports for the commit b48ea45 to get more accurate results Impacted file tree graph

@@            Coverage Diff             @@
##             main     #802      +/-   ##
==========================================
+ Coverage   94.72%   94.75%   +0.03%     
==========================================
  Files          83       84       +1     
  Lines        1213     1221       +8     
==========================================
+ Hits         1149     1157       +8     
  Misses         64       64              
Flag Coverage Δ
macos-latest 94.75% <100.00%> (+0.03%) :arrow_up:
py3.6 94.24% <100.00%> (+0.03%) :arrow_up:
py3.7 94.24% <100.00%> (+0.03%) :arrow_up:
py3.8 94.75% <100.00%> (+0.03%) :arrow_up:
py3.9 94.75% <100.00%> (+0.03%) :arrow_up:
pypypy3 94.24% <100.00%> (+0.03%) :arrow_up:
ubuntu-latest 94.75% <100.00%> (+0.03%) :arrow_up:
windows-latest 94.75% <100.00%> (+0.03%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
proselint/checks/passive_voice/misc.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update f8928ad...b48ea45. Read the comment docs.

codecov[bot] avatar May 30 '21 18:05 codecov[bot]

I will review the Garner checks now as it is likely they are already present in another check since we have most of GMEU implemented. The McCarl checks and passive voice check will additionally need to be split up into two separate PRs before this can continue.

Nytelife26 avatar May 30 '21 18:05 Nytelife26

The regex needs to be adjusted to pass the special cases checks. Perhaps the exceptions functionality might make that easier.

Nytelife26 avatar Jul 05 '21 15:07 Nytelife26