Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dialogue attribution and adverbs re: #106 #1080

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions proselint/.proselintrc
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"psychology.misc" : true,
"redundancy.misc" : true,
"redundancy.ras_syndrome" : true,
"redundancy.adverb_dialogue" : true,
"skunked_terms.misc" : true,
"spelling.able_atable" : true,
"spelling.able_ible" : true,
Expand Down
19 changes: 19 additions & 0 deletions proselint/checks/redundancy/adverb_dialogue.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-

"""Redundancy."""

from proselint.tools import memoize, is_quoted
import re


@memoize
def check(text):
"""Suggest the preferred forms."""
err = "redundancy.adverbdialogue"
Nytelife26 marked this conversation as resolved.
Show resolved Hide resolved
msg = "Redundant adverb. Remove {}."

# find if any of the text is in quote
regex = r'[\'"].*[,?!][\'"][\s\w]*?(\w+?ly)[\s\w]*[,.!?]'
matches = re.finditer(regex, text)
return [(match.start(1), match.end(1), err, msg.format(
match.groups(0)[0]), None) for match in matches]