Back to LanguageTool Homepage - Privacy - Imprint

Regarding setting a new rule


(thiru) #1

I'm trying to set a rule for Subjects and Verbs Agreement and my rule is
"When the subject of a sentence is composed of two or more nouns or pronouns connected by and, use a plural verb.".

For example, in the below sentence as the subject is composed of two nouns patient and Cavernoma and it is connected by and, so the following verb was should take plural form were.

The patient recovered well and no adverse events including further bleeding of the Cavernoma was observed.

Can you please help me write out a rule for the above.

Thanks in advance.


(Daniel Naber) #2

The reason the sentence needs "were" is the fact that "events" is in plural, it has nothing to do with the "and". You could rewrite the sentence into two sentences:

"The patient recovered well. No adverse events including further bleeding of the Cavernoma were observed."

Anyway, it's a complicated problem with no perfect solution. We have documented it here: http://wiki.languagetool.org/using-chunks, any help in making it work better is very welcome.


(thiru) #3

Is there a way it can be handled with new java rules.
Please let me know your ideas with samples if any.

Thanks!


(thiru) #4

hi,

May you please provide any java custom rule code for our reference .

Regards
Thiru M


(Daniel Naber) #5

Please see "Adding new Java rules" at http://wiki.languagetool.org/development-overview#toc18


(Mility) #6
<rule id="ID" name="">

 <pattern>
  <token chunk="B-NP-singular"></token>
  <token chunk="E-NP-singular"></token>
  <token skip='-1'>and</token>
  <token skip='-1' chunk="B-NP-singular"></token>
  <token chunk="E-NP-singular"></token>
  <marker>
  <token>was</token>
  </marker>
 </pattern>
 <message><suggestion>were</suggestion></message>
 <example correction=''>The patient recovered well and no adverse events including further bleeding of the Cavernoma <marker>was</marker> observed.</example>
 <example>The patient recovered well and no adverse events including further bleeding of the Cavernoma were observed.</example>
</rule>

I'm not sure it is true or false, for reference only.