Back to LanguageTool Homepage - Privacy - Imprint

Improve rule id="CLEARLY_OR_OBVIOUSLY"


(Kumara) #1

I want to replace this (existing) rule

<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>

But can't understand how to make it work.


(Mike Unwalla) #2

When I run testrules, I get this error message:

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.


(Kumara) #3

That's intended. The current rule catches too much to be useful.

Anyway, my issue is how to suggest the omission. Any way to suggest SENT_START?


(Mike Unwalla) #4

I don't understand. Can you give me an example?

I don't think that you can suggest SENT_START. Possibly, @dnaber can confirm/deny whether this is possible.


(Daniel Naber) #5

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.


(Kumara) #6

It doesn't cause an error, but doesn't give an empty suggestion either. Can you consider this enhancement request?

I know this one, but wonder if I can do without it.


(Kumara) #7

Finally settle with this one:

	<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>

Feel free to improve on it if necessary.


(Mike Unwalla) #8

On my task list.


(Mike Unwalla) #9

Done (https://github.com/languagetool-org/languagetool/commit/8e82ffd8111857f5e27eefbd195a84649b14a1e0).

@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.