<rule id="CLEARLY_OR_OBVIOUSLY" name="clearly, obviously">
<pattern>
<token regexp="yes">clearly|obviously</token>
</pattern>
<message>Remove wordy "\1"</message>
<example correction=""><marker>Obviously</marker>, this is it.</example>
<example>This is it.</example>
<example correction="">We have <marker>clearly</marker> arrived.</example>
<example>We have arrived.</example>
</rule>
with this one:
<rule id="OBVIOUSLY" name="obviously">
<pattern>
<token postag="SENT_START"/>
<token regexp="yes">obviously|clearly|doubtlessly</token>
</pattern>
<message>"\2" may be wordy or demeaning. Something that is obvious to you may not be so to the reader. Try omit<suggestion>\1</suggestion> or replace with <suggestion>certainly</suggestion>.</message>
<url>https://cgi.duke.edu/web/sciwriting/index.php?action=lesson3</url>
<short>Possibly wordy or demeaning adverb</short>
<example correction='\1'><marker>Obviously</marker> this is the most important point.</example>
<example>This is the most important point.</example>
<example correction='Certainly'><marker>Clearly</marker> we have arrived.</example>
<example>Certainly we have arrived.</example>
</rule>
Running pattern rule tests for English... Exception in thread "main" java.lang.AssertionError: English: Incorrect sugges
tions: [\1] != [, Certainly] for rule OBVIOUSLY[1] on input: Obviously this is the most important point. expected:<[\1]>
but was:<[, Certainly]>
When I change the message to Try to omit "\2" or replace with <suggestion>certainly</suggestion>, I get this error:
Running pattern rule tests for English... Exception in thread "main" java.lang.AssertionError: English: Incorrect sugges
tions: [\1] != [Certainly] for rule OBVIOUSLY[1] on input: Obviously this is the most important point. expected:<[\1]> b
ut was:<[Certainly]>
Change the correction to <example correction='Certainly'> and testrules gives no warnings.
But, the rule does not find the adverbs if they are not at the start of a sentence: … but clearly, this is a problem.
You can (I think) have an empty suggestion: <suggestion></suggestion>, if that helps. Or you can use <suggestion>\2</suggestion> if the <marker> spans two tokens, so the first would be omitted in the suggestion.
<rule id="OBVIOUSLY" name="obviously, clearly, doubtlessly">
<pattern>
<token postag="SENT_START"/>
<token regexp="yes">obviously|clearly|doubtlessly</token>
<token/>
<token/>
</pattern>
<message>"\2" may be redundant or demeaning. Something that is obvious to you may not be so to the reader. Try omit or replace with <suggestion>certainly</suggestion>.</message>
<suggestion>\4</suggestion>
<suggestion>\3 \4</suggestion>
<url>https://cgi.duke.edu/web/sciwriting/index.php?action=lesson3</url>
<short>Possibly wordy or demeaning adverb</short>
<example correction=''><marker>Obviously, this</marker> is the most important point.</example>
<example>This is the most important point.</example>
<example correction=''><marker>Clearly we have</marker> arrived.</example>
<example>Certainly we have arrived.</example>
</rule>
@Kumara wrote: The current rule catches too much to be useful.
I do not agree. The Duke University web page does not suggest that the words are a problem only if they are at the start of a sentence. Thus, I did not restrict the rule to find the adverbs only if they are at the start of a sentence.