Regarding setting a new rule

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.

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: Using Chunks - LanguageTool Wiki, any help in making it work better is very welcome.

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

Thanks!

hi,

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

Regards
Thiru M

Please see “Adding new Java rules” at Development Overview - LanguageTool Wiki

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