opengrammar-server 2.0.644277

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/README.npm.md +95 -0
  2. package/bin/opengrammar-server.js +111 -0
  3. package/dist/server.js +48639 -0
  4. package/package.json +80 -0
  5. package/server-node.ts +159 -0
  6. package/server.ts +15 -0
  7. package/src/analyzer.ts +542 -0
  8. package/src/dictionary.ts +1973 -0
  9. package/src/index.ts +978 -0
  10. package/src/nlp/nlp-engine.ts +17 -0
  11. package/src/nlp/tone-analyzer.ts +269 -0
  12. package/src/rephraser.ts +146 -0
  13. package/src/rules/categories/academic-writing.ts +182 -0
  14. package/src/rules/categories/adjectives-adverbs.ts +152 -0
  15. package/src/rules/categories/articles.ts +160 -0
  16. package/src/rules/categories/business-writing.ts +250 -0
  17. package/src/rules/categories/capitalization.ts +79 -0
  18. package/src/rules/categories/clarity.ts +117 -0
  19. package/src/rules/categories/common-errors.ts +601 -0
  20. package/src/rules/categories/confused-words.ts +219 -0
  21. package/src/rules/categories/conjunctions.ts +176 -0
  22. package/src/rules/categories/dangling-modifiers.ts +123 -0
  23. package/src/rules/categories/formality.ts +274 -0
  24. package/src/rules/categories/formatting-idioms.ts +323 -0
  25. package/src/rules/categories/gerund-infinitive.ts +274 -0
  26. package/src/rules/categories/grammar-advanced.ts +294 -0
  27. package/src/rules/categories/grammar.ts +286 -0
  28. package/src/rules/categories/inclusive-language.ts +280 -0
  29. package/src/rules/categories/nouns-pronouns.ts +233 -0
  30. package/src/rules/categories/prepositions-extended.ts +217 -0
  31. package/src/rules/categories/prepositions.ts +159 -0
  32. package/src/rules/categories/punctuation.ts +347 -0
  33. package/src/rules/categories/quantity-agreement.ts +200 -0
  34. package/src/rules/categories/readability.ts +293 -0
  35. package/src/rules/categories/sentence-structure.ts +100 -0
  36. package/src/rules/categories/spelling-advanced.ts +164 -0
  37. package/src/rules/categories/spelling.ts +119 -0
  38. package/src/rules/categories/style-tone.ts +511 -0
  39. package/src/rules/categories/style.ts +78 -0
  40. package/src/rules/categories/subject-verb-agreement.ts +201 -0
  41. package/src/rules/categories/tone-rules.ts +206 -0
  42. package/src/rules/categories/verb-tense.ts +582 -0
  43. package/src/rules/context-filter.ts +446 -0
  44. package/src/rules/index.ts +96 -0
  45. package/src/rules/ruleset-part1-cj-pu-sp.json +657 -0
  46. package/src/rules/ruleset-part1-np-ad-aa-pr.json +831 -0
  47. package/src/rules/ruleset-part1-ss-vt.json +907 -0
  48. package/src/rules/ruleset-part2-cw-st-nf.json +318 -0
  49. package/src/rules/ruleset-part3-aw-bw-il-rd.json +161 -0
  50. package/src/rules/types.ts +79 -0
  51. package/src/shared-types.ts +152 -0
  52. package/src/spellchecker.ts +418 -0
  53. package/tsconfig.json +25 -0
@@ -0,0 +1,831 @@
1
+ {
2
+ "version": "1.0.0",
3
+ "generated_for": "OpenGrammar Engine",
4
+ "part": "1B_of_3",
5
+ "categories": [
6
+ {
7
+ "code": "NP",
8
+ "name": "Nouns & Pronouns",
9
+ "rules": [
10
+ {
11
+ "rule_id": "NP_AGR_001",
12
+ "category": "Nouns & Pronouns",
13
+ "subcategory": "Pronoun-Antecedent Agreement",
14
+ "title": "Singular antecedent with plural pronoun",
15
+ "description": "A pronoun must agree in number with its antecedent.",
16
+ "severity": "error",
17
+ "language_register": "formal",
18
+ "pattern_description": "Match singular indefinite (everyone, someone, anybody, each, every, nobody, anyone, no one) followed by plural pronoun (they, them, their, themselves) in formal register.",
19
+ "examples": {
20
+ "incorrect": [
21
+ "Everyone should bring their own lunch.",
22
+ "Somebody left their bag.",
23
+ "Each student must submit their work."
24
+ ],
25
+ "correct": [
26
+ "Everyone should bring his or her own lunch.",
27
+ "Somebody left his or her bag.",
28
+ "Each student must submit his or her work."
29
+ ]
30
+ },
31
+ "exceptions": [
32
+ "Singular they is widely accepted in modern English and is mandatory when referring to non-binary individuals. Flag only in very formal/academic register."
33
+ ],
34
+ "fix_hint": "In formal writing, use 'his or her' or restructure (pluralize the antecedent).",
35
+ "british_variant": "Singular they more widely accepted in British English."
36
+ },
37
+ {
38
+ "rule_id": "NP_CAS_001",
39
+ "category": "Nouns & Pronouns",
40
+ "subcategory": "Pronoun Case",
41
+ "title": "'Between you and I' error",
42
+ "description": "After prepositions, use object pronouns (me, him, her, us, them), not subject pronouns.",
43
+ "severity": "error",
44
+ "language_register": "both",
45
+ "pattern_description": "Regex: /\\b(between|beside|except|for|from|to|with|without|about|against|among)\\s+(you|him|her|them|us)\\s+and\\s+(I|he|she|they|we)\\b/i",
46
+ "examples": {
47
+ "incorrect": [
48
+ "Between you and I, it's wrong.",
49
+ "This is for you and I.",
50
+ "Come with she and I.",
51
+ "It's between he and I."
52
+ ],
53
+ "correct": [
54
+ "Between you and me, it's wrong.",
55
+ "This is for you and me.",
56
+ "Come with her and me.",
57
+ "It's between him and me."
58
+ ]
59
+ },
60
+ "exceptions": [],
61
+ "fix_hint": "Replace the subject pronoun with the corresponding object pronoun.",
62
+ "british_variant": "No significant difference."
63
+ },
64
+ {
65
+ "rule_id": "NP_CAS_002",
66
+ "category": "Nouns & Pronouns",
67
+ "subcategory": "Pronoun Case",
68
+ "title": "Object pronoun as subject",
69
+ "description": "Subject position requires subject pronouns (I, he, she, we, they), not object pronouns.",
70
+ "severity": "error",
71
+ "language_register": "both",
72
+ "pattern_description": "Regex: /\\b(me|him|her|them|us)\\s+and\\s+(I|he|she|they|we)\\s+(is|are|was|were|went|had|has|have|will|would|can|could|shall|should|did|do|does)\\b/i",
73
+ "examples": {
74
+ "incorrect": [
75
+ "Me and him went to the store.",
76
+ "Her and I went out.",
77
+ "Him and me are friends.",
78
+ "Us and them are different."
79
+ ],
80
+ "correct": [
81
+ "He and I went to the store.",
82
+ "She and I went out.",
83
+ "He and I are friends.",
84
+ "We and they are different."
85
+ ]
86
+ },
87
+ "exceptions": ["Informal speech widely uses object pronouns in compound subjects."],
88
+ "fix_hint": "Replace object pronouns with subject pronouns when used as the subject.",
89
+ "british_variant": "No significant difference."
90
+ },
91
+ {
92
+ "rule_id": "NP_WHO_001",
93
+ "category": "Nouns & Pronouns",
94
+ "subcategory": "Who vs Whom",
95
+ "title": "Who/whom after prepositions",
96
+ "description": "After prepositions (to, for, with, by, about, from), use 'whom' not 'who'.",
97
+ "severity": "warning",
98
+ "language_register": "formal",
99
+ "pattern_description": "Regex: /\\b(to|for|with|by|about|from|at|of|between|among)\\s+who\\b/i",
100
+ "examples": {
101
+ "incorrect": [
102
+ "To who did you give it?",
103
+ "For who is this?",
104
+ "With who are you going?",
105
+ "By who was it made?"
106
+ ],
107
+ "correct": [
108
+ "To whom did you give it?",
109
+ "For whom is this?",
110
+ "With whom are you going?",
111
+ "By whom was it made?"
112
+ ]
113
+ },
114
+ "exceptions": [
115
+ "Informal English widely uses 'who' in all positions. Flag only in formal register."
116
+ ],
117
+ "fix_hint": "Replace 'who' with 'whom' after prepositions.",
118
+ "british_variant": "No significant difference."
119
+ },
120
+ {
121
+ "rule_id": "NP_REF_001",
122
+ "category": "Nouns & Pronouns",
123
+ "subcategory": "Reflexive Pronouns",
124
+ "title": "Reflexive pronoun used as subject or object substitute",
125
+ "description": "Reflexive pronouns (myself, yourself, himself, etc.) should only be used when subject and object are the same person, or for emphasis.",
126
+ "severity": "warning",
127
+ "language_register": "formal",
128
+ "pattern_description": "Regex: /\\b(contact|call|email|reach|send|give|tell|ask|invite|join)\\s+(myself|yourself|himself|herself|themselves|ourselves)\\b/i or sentence-initial /\\b(myself|yourself)\\s+(and|will|am|have|had)\\b/i",
129
+ "examples": {
130
+ "incorrect": [
131
+ "Please contact myself for details.",
132
+ "Myself and John went to the meeting.",
133
+ "Send it to myself.",
134
+ "Please join myself for dinner."
135
+ ],
136
+ "correct": [
137
+ "Please contact me for details.",
138
+ "John and I went to the meeting.",
139
+ "Send it to me.",
140
+ "Please join me for dinner."
141
+ ]
142
+ },
143
+ "exceptions": [
144
+ "Correct: 'I hurt myself.' (subject = object). 'I myself did it.' (emphasis)."
145
+ ],
146
+ "fix_hint": "Replace the reflexive pronoun with 'me', 'I', etc. as appropriate.",
147
+ "british_variant": "No significant difference."
148
+ },
149
+ {
150
+ "rule_id": "NP_CNT_001",
151
+ "category": "Nouns & Pronouns",
152
+ "subcategory": "Noun Countability",
153
+ "title": "Uncountable noun used with a/an or pluralized",
154
+ "description": "Uncountable nouns cannot take the indefinite article a/an and cannot be pluralized.",
155
+ "severity": "error",
156
+ "language_register": "both",
157
+ "pattern_description": "Match (a|an) + uncountable noun or uncountable noun + plural -s. Uncountable nouns: information, advice, furniture, equipment, luggage, baggage, news, progress, research, work, homework, evidence, knowledge, traffic, weather, money, music, art, luck, fun, happiness, sadness, anger, water, rice, bread, sugar, milk, coffee, tea, gold, silver, oxygen, electricity, software, hardware, feedback, data (in formal usage), clothing, scenery, poetry, machinery, vocabulary.",
158
+ "examples": {
159
+ "incorrect": [
160
+ "I need an information.",
161
+ "She gave me advices.",
162
+ "We bought new furnitures.",
163
+ "He has many luggages.",
164
+ "There are too many traffics."
165
+ ],
166
+ "correct": [
167
+ "I need some information.",
168
+ "She gave me advice.",
169
+ "We bought new furniture.",
170
+ "He has a lot of luggage.",
171
+ "There is too much traffic."
172
+ ]
173
+ },
174
+ "exceptions": [
175
+ "Some nouns can be both: 'a coffee' (= a cup of coffee), 'works' (literary/artistic works), 'waters' (bodies of water)."
176
+ ],
177
+ "fix_hint": "Remove the article or use a quantifier (some, a piece of, much). Remove plural -s.",
178
+ "british_variant": "No significant difference."
179
+ },
180
+ {
181
+ "rule_id": "NP_PLU_001",
182
+ "category": "Nouns & Pronouns",
183
+ "subcategory": "Noun Plurals",
184
+ "title": "Irregular plural errors",
185
+ "description": "Some nouns have irregular plural forms that don't follow the -s/-es pattern.",
186
+ "severity": "error",
187
+ "language_register": "both",
188
+ "pattern_description": "Match wrong plurals: childs→children, mans→men, womans→women, tooths→teeth, foots→feet, mouses→mice, gooses→geese, oxes→oxen, persons→people (in general sense), criterions→criteria, phenomenons→phenomena, datums→data, alumnus→alumni, cactuses→cacti (both accepted), funguses→fungi, syllabuses→syllabi, appendixs→appendices.",
189
+ "examples": {
190
+ "incorrect": [
191
+ "The childs are playing.",
192
+ "There were many mans.",
193
+ "She has two tooths missing.",
194
+ "The mouses escaped.",
195
+ "The criterions are strict."
196
+ ],
197
+ "correct": [
198
+ "The children are playing.",
199
+ "There were many men.",
200
+ "She has two teeth missing.",
201
+ "The mice escaped.",
202
+ "The criteria are strict."
203
+ ]
204
+ },
205
+ "exceptions": [
206
+ "'Persons' is valid in legal/formal contexts. 'Cactuses' and 'cacti' both accepted."
207
+ ],
208
+ "fix_hint": "Replace the incorrect plural with the correct irregular form.",
209
+ "british_variant": "No significant difference."
210
+ }
211
+ ]
212
+ },
213
+ {
214
+ "code": "AD",
215
+ "name": "Articles & Determiners",
216
+ "rules": [
217
+ {
218
+ "rule_id": "AD_AAN_001",
219
+ "category": "Articles & Determiners",
220
+ "subcategory": "A vs An",
221
+ "title": "Article a/an based on sound",
222
+ "description": "Use 'a' before consonant sounds and 'an' before vowel sounds — based on pronunciation, not spelling.",
223
+ "severity": "error",
224
+ "language_register": "both",
225
+ "pattern_description": "Check the next word's initial sound. Words starting with silent h (hour, honest, honor, heir, herb) need 'an'. Words with consonant-sounding vowels (university, uniform, united, unique, European, one, once, useful) need 'a'. Acronyms depend on pronunciation (an FBI, a NASA, an HTML, a URL).",
226
+ "examples": {
227
+ "incorrect": [
228
+ "A honest man.",
229
+ "A hour ago.",
230
+ "An university.",
231
+ "An European city.",
232
+ "A FBI agent.",
233
+ "An one-time offer."
234
+ ],
235
+ "correct": [
236
+ "An honest man.",
237
+ "An hour ago.",
238
+ "A university.",
239
+ "A European city.",
240
+ "An FBI agent.",
241
+ "A one-time offer."
242
+ ]
243
+ },
244
+ "exceptions": [
245
+ "Historical or regional pronunciation may vary: 'a/an historic' (both accepted)."
246
+ ],
247
+ "fix_hint": "Switch 'a' to 'an' or vice versa based on the following word's SOUND.",
248
+ "british_variant": "'An hotel' and 'an historic' are sometimes used in formal British English."
249
+ },
250
+ {
251
+ "rule_id": "AD_THE_001",
252
+ "category": "Articles & Determiners",
253
+ "subcategory": "Definite Article Errors",
254
+ "title": "Unnecessary 'the' with general/abstract nouns",
255
+ "description": "Do not use 'the' with uncountable or plural nouns when speaking in general terms.",
256
+ "severity": "warning",
257
+ "language_register": "both",
258
+ "pattern_description": "Regex: /\\bthe\\s+(life|love|death|nature|society|education|music|art|science|politics|history|time|happiness|freedom|democracy|justice|beauty|truth|knowledge|information|water|air)\\s+(is|are|was|were|has|can|will|should|must)\\b/i — when used in general philosophical sense.",
259
+ "examples": {
260
+ "incorrect": [
261
+ "The life is beautiful.",
262
+ "The music is my passion.",
263
+ "The education is important.",
264
+ "The love conquers all."
265
+ ],
266
+ "correct": [
267
+ "Life is beautiful.",
268
+ "Music is my passion.",
269
+ "Education is important.",
270
+ "Love conquers all."
271
+ ]
272
+ },
273
+ "exceptions": [
274
+ "'The life of the party' (specific). 'The music was too loud' (specific instance). 'The education system' (specific system)."
275
+ ],
276
+ "fix_hint": "Remove 'the' when referring to the concept in general.",
277
+ "british_variant": "No significant difference."
278
+ },
279
+ {
280
+ "rule_id": "AD_THE_002",
281
+ "category": "Articles & Determiners",
282
+ "subcategory": "Definite Article Errors",
283
+ "title": "Unnecessary 'the' with sports and meals",
284
+ "description": "Do not use 'the' before sports or meal names in general sense.",
285
+ "severity": "warning",
286
+ "language_register": "both",
287
+ "pattern_description": "Regex: /\\b(play|plays|played|playing)\\s+the\\s+(tennis|football|soccer|basketball|baseball|cricket|golf|volleyball|badminton|hockey|rugby|chess)\\b/i and /\\bhad\\s+the\\s+(breakfast|lunch|dinner|supper|brunch)\\b/i",
288
+ "examples": {
289
+ "incorrect": [
290
+ "She plays the tennis.",
291
+ "He plays the football.",
292
+ "We had the dinner at home.",
293
+ "I had the lunch at noon."
294
+ ],
295
+ "correct": [
296
+ "She plays tennis.",
297
+ "He plays football.",
298
+ "We had dinner at home.",
299
+ "I had lunch at noon."
300
+ ]
301
+ },
302
+ "exceptions": [
303
+ "'Play the piano/guitar' — musical instruments DO take 'the'. 'The dinner was excellent' (specific dinner)."
304
+ ],
305
+ "fix_hint": "Remove 'the' before sport or meal names in general usage.",
306
+ "british_variant": "No significant difference."
307
+ },
308
+ {
309
+ "rule_id": "AD_FEW_001",
310
+ "category": "Articles & Determiners",
311
+ "subcategory": "Fewer vs Less",
312
+ "title": "Less with countable nouns",
313
+ "description": "Use 'fewer' with countable plural nouns. 'Less' is for uncountable nouns.",
314
+ "severity": "warning",
315
+ "language_register": "formal",
316
+ "pattern_description": "Regex: /\\bless\\s+(items|things|people|words|books|cars|houses|dogs|cats|students|teachers|errors|problems|questions|answers|options|choices|opportunities|minutes|hours|days|weeks|months|years|dollars|euros|points|runs|goals|votes|members|employees|customers|passengers|participants|applicants|candidates|complaints|accidents|mistakes|changes|differences|similarities|examples|instances|cases|reasons|factors|elements|features|aspects|details|steps|stages|levels|layers|pieces|parts|sections|chapters|pages|paragraphs|sentences|lines|rows|columns|files|folders|tabs|windows|buttons|clicks|downloads|uploads|messages|emails|calls|meetings|events|tasks|projects|assignments|lessons|classes|courses|subjects|topics|ideas|concepts|theories|models|versions|updates|releases|issues|bugs|tickets|stories|articles|posts|comments|reviews|ratings|likes|shares|followers|subscribers|users|accounts|transactions|payments|orders|shipments|deliveries)\\b/i",
317
+ "examples": {
318
+ "incorrect": [
319
+ "Less people came.",
320
+ "There are less options.",
321
+ "10 items or less.",
322
+ "Less mistakes this time."
323
+ ],
324
+ "correct": [
325
+ "Fewer people came.",
326
+ "There are fewer options.",
327
+ "10 items or fewer.",
328
+ "Fewer mistakes this time."
329
+ ]
330
+ },
331
+ "exceptions": [
332
+ "'Less than' with numbers/amounts is acceptable: 'less than 10 miles', 'less than $50'. Supermarket '10 items or less' is traditional."
333
+ ],
334
+ "fix_hint": "Replace 'less' with 'fewer' before countable plural nouns.",
335
+ "british_variant": "No significant difference."
336
+ },
337
+ {
338
+ "rule_id": "AD_MCH_001",
339
+ "category": "Articles & Determiners",
340
+ "subcategory": "Much/Many",
341
+ "title": "Much with countable nouns or many with uncountable",
342
+ "description": "Use 'much' with uncountable nouns and 'many' with countable plural nouns.",
343
+ "severity": "warning",
344
+ "language_register": "both",
345
+ "pattern_description": "Match 'much' + countable plural noun or 'many' + uncountable noun.",
346
+ "examples": {
347
+ "incorrect": [
348
+ "How much people?",
349
+ "Too much books.",
350
+ "How many information?",
351
+ "Many money.",
352
+ "Much problems."
353
+ ],
354
+ "correct": [
355
+ "How many people?",
356
+ "Too many books.",
357
+ "How much information?",
358
+ "Much money.",
359
+ "Many problems."
360
+ ]
361
+ },
362
+ "exceptions": [
363
+ "'Much' in questions/negatives: 'Not much time.' is natural. 'How much time?' is correct."
364
+ ],
365
+ "fix_hint": "Replace 'much' with 'many' for countable nouns and vice versa.",
366
+ "british_variant": "No significant difference."
367
+ },
368
+ {
369
+ "rule_id": "AD_AMT_001",
370
+ "category": "Articles & Determiners",
371
+ "subcategory": "Amount vs Number",
372
+ "title": "Amount with countable nouns",
373
+ "description": "Use 'number' with countable nouns and 'amount' with uncountable nouns.",
374
+ "severity": "warning",
375
+ "language_register": "formal",
376
+ "pattern_description": "Regex: /\\b(amount|amounts)\\s+of\\s+(people|items|things|students|books|cars|errors|problems|words|pages|files|changes|members|employees|customers|users|tasks|steps|questions|answers|ideas|options|choices|reasons|factors|examples|cases|details|features|attempts|complaints)\\b/i",
377
+ "examples": {
378
+ "incorrect": [
379
+ "The amount of people was large.",
380
+ "A large amount of errors.",
381
+ "The amount of students increased."
382
+ ],
383
+ "correct": [
384
+ "The number of people was large.",
385
+ "A large number of errors.",
386
+ "The number of students increased."
387
+ ]
388
+ },
389
+ "exceptions": [
390
+ "'Amount of' is increasingly accepted with countable nouns in informal English."
391
+ ],
392
+ "fix_hint": "Replace 'amount of' with 'number of' before countable nouns.",
393
+ "british_variant": "No significant difference."
394
+ },
395
+ {
396
+ "rule_id": "AD_ENO_001",
397
+ "category": "Articles & Determiners",
398
+ "subcategory": "Enough Placement",
399
+ "title": "Enough before adjective instead of after",
400
+ "description": "'Enough' goes AFTER adjectives and adverbs, but BEFORE nouns.",
401
+ "severity": "error",
402
+ "language_register": "both",
403
+ "pattern_description": "Regex: /\\benough\\s+(big|tall|good|strong|fast|old|young|smart|rich|warm|cold|hot|cool|large|small|high|low|wide|deep|long|short|loud|quiet|hard|soft|bright|dark|clean|clear|safe|brave|kind|nice|sweet|easy|difficult|important|interesting|cheap|expensive)\\b/i",
404
+ "examples": {
405
+ "incorrect": [
406
+ "It's not enough big.",
407
+ "She is enough old.",
408
+ "He is enough strong.",
409
+ "The room is enough warm."
410
+ ],
411
+ "correct": [
412
+ "It's not big enough.",
413
+ "She is old enough.",
414
+ "He is strong enough.",
415
+ "The room is warm enough."
416
+ ]
417
+ },
418
+ "exceptions": [
419
+ "Before nouns: 'enough money', 'enough time', 'enough space' — this is correct."
420
+ ],
421
+ "fix_hint": "Move 'enough' to after the adjective/adverb.",
422
+ "british_variant": "No significant difference."
423
+ }
424
+ ]
425
+ },
426
+ {
427
+ "code": "AA",
428
+ "name": "Adjectives & Adverbs",
429
+ "rules": [
430
+ {
431
+ "rule_id": "AA_ADV_001",
432
+ "category": "Adjectives & Adverbs",
433
+ "subcategory": "Adjective vs Adverb Confusion",
434
+ "title": "Adjective used instead of adverb",
435
+ "description": "Adverbs modify verbs, adjectives, and other adverbs. Use the -ly form, not the adjective, after action verbs.",
436
+ "severity": "error",
437
+ "language_register": "both",
438
+ "pattern_description": "Match action verb + adjective where adverb is needed: 'runs quick'→'runs quickly', 'speaks loud'→'speaks loudly', 'drives slow'→'drives slowly', 'writes bad'→'writes badly'.",
439
+ "examples": {
440
+ "incorrect": [
441
+ "She sings beautiful.",
442
+ "He runs quick.",
443
+ "They spoke loud.",
444
+ "She drives slow.",
445
+ "He writes bad."
446
+ ],
447
+ "correct": [
448
+ "She sings beautifully.",
449
+ "He runs quickly.",
450
+ "They spoke loudly.",
451
+ "She drives slowly.",
452
+ "He writes badly."
453
+ ]
454
+ },
455
+ "exceptions": [
456
+ "Flat adverbs: 'drive fast' (not 'fastly'), 'work hard' (not 'hardly', which means 'barely'). After linking verbs: 'She looks good' (adjective is correct)."
457
+ ],
458
+ "fix_hint": "Add -ly to the adjective to form the correct adverb.",
459
+ "british_variant": "'Slow/slowly' — both accepted as adverbs in British English."
460
+ },
461
+ {
462
+ "rule_id": "AA_CMP_001",
463
+ "category": "Adjectives & Adverbs",
464
+ "subcategory": "Comparative/Superlative Forms",
465
+ "title": "Double comparative",
466
+ "description": "Do not combine 'more' with the -er comparative form or 'most' with the -est superlative form.",
467
+ "severity": "error",
468
+ "language_register": "both",
469
+ "pattern_description": "Regex: /\\bmore\\s+(bigger|smaller|taller|shorter|faster|slower|older|younger|easier|harder|simpler|wider|narrower|louder|quieter|nicer|safer|cleaner|closer|newer|darker|brighter|stronger|weaker|smarter|cheaper|richer|poorer|thinner|thicker|longer|lighter|heavier|cooler|warmer|hotter|colder|drier|wetter)\\b/i and /\\bmost\\s+(biggest|smallest|tallest|shortest|fastest|slowest|oldest|youngest|easiest|hardest|simplest|widest|narrowest|loudest|quietest|nicest|safest|cleanest|closest|newest|darkest|brightest|strongest|weakest|smartest|cheapest|richest|poorest|thinnest|thickest|longest|lightest|heaviest|coolest|warmest|hottest|coldest|driest|wettest)\\b/i",
470
+ "examples": {
471
+ "incorrect": [
472
+ "He is more taller.",
473
+ "She is the most tallest.",
474
+ "This is more better.",
475
+ "That is the most fastest."
476
+ ],
477
+ "correct": [
478
+ "He is taller.",
479
+ "She is the tallest.",
480
+ "This is better.",
481
+ "That is the fastest."
482
+ ]
483
+ },
484
+ "exceptions": [],
485
+ "fix_hint": "Remove 'more' or 'most' — the -er/-est form already expresses comparison.",
486
+ "british_variant": "No significant difference."
487
+ },
488
+ {
489
+ "rule_id": "AA_IRR_001",
490
+ "category": "Adjectives & Adverbs",
491
+ "subcategory": "Irregular Comparatives",
492
+ "title": "Regularized irregular comparative/superlative",
493
+ "description": "Some adjectives have irregular comparative/superlative forms that must be used instead of adding -er/-est.",
494
+ "severity": "error",
495
+ "language_register": "both",
496
+ "pattern_description": "Match: gooder→better, goodest→best, badder→worse, baddest→worst, more good→better, most good→best, more bad→worse, most bad→worst, more well→better, most well→best, littler→less, farer→farther/further.",
497
+ "examples": {
498
+ "incorrect": [
499
+ "This is gooder.",
500
+ "That was the baddest day.",
501
+ "She is more good at math.",
502
+ "This is the most good solution.",
503
+ "It's badder than before."
504
+ ],
505
+ "correct": [
506
+ "This is better.",
507
+ "That was the worst day.",
508
+ "She is better at math.",
509
+ "This is the best solution.",
510
+ "It's worse than before."
511
+ ]
512
+ },
513
+ "exceptions": [
514
+ "'Baddest' is slang for 'toughest/coolest'. 'Littler' is sometimes used informally for 'smaller'."
515
+ ],
516
+ "fix_hint": "Replace with the correct irregular form.",
517
+ "british_variant": "farther (distance) vs further (degree/metaphorical) — British uses 'further' for both."
518
+ },
519
+ {
520
+ "rule_id": "AA_ABS_001",
521
+ "category": "Adjectives & Adverbs",
522
+ "subcategory": "Absolute Adjectives",
523
+ "title": "Comparing absolute adjectives",
524
+ "description": "Absolute adjectives (unique, perfect, complete, dead, infinite, impossible, universal, absolute, essential, fatal, final, total, eternal, entire, supreme) cannot logically be compared.",
525
+ "severity": "suggestion",
526
+ "language_register": "formal",
527
+ "pattern_description": "Regex: /\\b(more|most|very|extremely|really|somewhat|rather|slightly|fairly|absolutely)\\s+(unique|perfect|complete|dead|infinite|impossible|universal|absolute|essential|fatal|final|total|eternal|entire|supreme|unanimous|empty|full|equal|round|square|true|false|pregnant|correct|incorrect)\\b/i",
528
+ "examples": {
529
+ "incorrect": [
530
+ "This is very unique.",
531
+ "A more perfect union.",
532
+ "The most complete list.",
533
+ "He is very dead.",
534
+ "This is more impossible."
535
+ ],
536
+ "correct": [
537
+ "This is unique.",
538
+ "A nearly perfect union.",
539
+ "The most nearly complete list.",
540
+ "He is dead.",
541
+ "This is impossible."
542
+ ]
543
+ },
544
+ "exceptions": [
545
+ "'A more perfect union' — from US Constitution, accepted as established phrase. 'Very' can sometimes mean 'truly/in every sense': 'the very essence'."
546
+ ],
547
+ "fix_hint": "Remove the modifier or use 'nearly', 'almost', or 'virtually' instead.",
548
+ "british_variant": "No significant difference."
549
+ },
550
+ {
551
+ "rule_id": "AA_PAR_001",
552
+ "category": "Adjectives & Adverbs",
553
+ "subcategory": "Participial Adjectives",
554
+ "title": "-ed vs -ing adjective confusion",
555
+ "description": "-ed adjectives describe how someone FEELS; -ing adjectives describe what CAUSES the feeling.",
556
+ "severity": "error",
557
+ "language_register": "both",
558
+ "pattern_description": "Match person/pronoun + 'is/am/are/was/were/feel/felt' + wrong form: 'I am boring' (should be bored), 'The movie is bored' (should be boring).",
559
+ "examples": {
560
+ "incorrect": [
561
+ "I am boring.",
562
+ "He is interesting in science.",
563
+ "She was confusing.",
564
+ "The students are tiring.",
565
+ "We are exciting about the trip."
566
+ ],
567
+ "correct": [
568
+ "I am bored.",
569
+ "He is interested in science.",
570
+ "She was confused.",
571
+ "The students are tired.",
572
+ "We are excited about the trip."
573
+ ]
574
+ },
575
+ "exceptions": [
576
+ "'She is boring' can be correct if describing her personality (she causes boredom). Context is key."
577
+ ],
578
+ "fix_hint": "Use -ed when describing a person's feelings, -ing when describing the cause.",
579
+ "british_variant": "No significant difference."
580
+ },
581
+ {
582
+ "rule_id": "AA_GDW_001",
583
+ "category": "Adjectives & Adverbs",
584
+ "subcategory": "Good/Well Confusion",
585
+ "title": "Good vs well confusion",
586
+ "description": "'Good' is an adjective (modifies nouns). 'Well' is an adverb (modifies verbs). After linking verbs, use 'good' for quality and 'well' for health.",
587
+ "severity": "error",
588
+ "language_register": "both",
589
+ "pattern_description": "Match action verbs + 'good' where 'well' is needed: 'plays good', 'writes good', 'performs good', 'works good', 'functions good', 'runs good', 'speaks good', 'sings good', 'dances good', 'cooks good'.",
590
+ "examples": {
591
+ "incorrect": [
592
+ "She plays good.",
593
+ "He speaks English good.",
594
+ "The car runs good.",
595
+ "They work good together.",
596
+ "She sings real good."
597
+ ],
598
+ "correct": [
599
+ "She plays well.",
600
+ "He speaks English well.",
601
+ "The car runs well.",
602
+ "They work well together.",
603
+ "She sings really well."
604
+ ]
605
+ },
606
+ "exceptions": [
607
+ "After linking verbs: 'I feel good' (emotional state — correct). 'I feel well' (health — also correct). 'She looks good' (appearance — correct)."
608
+ ],
609
+ "fix_hint": "Replace 'good' with 'well' after action verbs.",
610
+ "british_variant": "No significant difference."
611
+ }
612
+ ]
613
+ },
614
+ {
615
+ "code": "PR",
616
+ "name": "Prepositions",
617
+ "rules": [
618
+ {
619
+ "rule_id": "PR_COL_001",
620
+ "category": "Prepositions",
621
+ "subcategory": "Prepositional Collocations",
622
+ "title": "Wrong preposition after common verbs",
623
+ "description": "Many verbs require specific prepositions. Using the wrong preposition is a common error.",
624
+ "severity": "warning",
625
+ "language_register": "both",
626
+ "pattern_description": "Match: 'discuss about'→'discuss', 'reach to'→'reach', 'return back'→'return', 'enter into' (room)→'enter', 'cope up with'→'cope with', 'comprise of'→'comprise'/'is composed of', 'emphasize on'→'emphasize', 'mention about'→'mention', 'explain me'→'explain to me', 'request for'→'request', 'demand for'→'demand', 'order for'→'order', 'approach to'→'approach'.",
627
+ "examples": {
628
+ "incorrect": [
629
+ "Let's discuss about this.",
630
+ "She reached to the shelf.",
631
+ "He returned back.",
632
+ "We entered into the building.",
633
+ "I can't cope up with it.",
634
+ "The team comprises of five members."
635
+ ],
636
+ "correct": [
637
+ "Let's discuss this.",
638
+ "She reached the shelf.",
639
+ "He returned.",
640
+ "We entered the building.",
641
+ "I can't cope with it.",
642
+ "The team comprises five members."
643
+ ]
644
+ },
645
+ "exceptions": [
646
+ "'enter into' is correct for agreements: 'enter into a contract'. 'return to' (destination) is correct."
647
+ ],
648
+ "fix_hint": "Remove the unnecessary preposition or replace with the correct one.",
649
+ "british_variant": "No significant difference."
650
+ },
651
+ {
652
+ "rule_id": "PR_TIM_001",
653
+ "category": "Prepositions",
654
+ "subcategory": "Time Prepositions",
655
+ "title": "Wrong time preposition (at/on/in)",
656
+ "description": "Use 'at' for specific times, 'on' for days/dates, 'in' for months/years/seasons.",
657
+ "severity": "warning",
658
+ "language_register": "both",
659
+ "pattern_description": "Match: 'in Monday'→'on Monday', 'at January'→'in January', 'on 5 o'clock'→'at 5 o'clock', 'in Monday morning'→'on Monday morning', 'at 2024'→'in 2024'.",
660
+ "examples": {
661
+ "incorrect": [
662
+ "I'll see you in Monday.",
663
+ "She was born at January.",
664
+ "The meeting is on 3 PM.",
665
+ "We met at 2024.",
666
+ "In Christmas Day, we celebrate."
667
+ ],
668
+ "correct": [
669
+ "I'll see you on Monday.",
670
+ "She was born in January.",
671
+ "The meeting is at 3 PM.",
672
+ "We met in 2024.",
673
+ "On Christmas Day, we celebrate."
674
+ ]
675
+ },
676
+ "exceptions": [
677
+ "'At Christmas/Easter' (the holiday period) vs 'on Christmas Day' (the specific day). 'At night' (not 'in the night' in AmE). 'In the morning/afternoon/evening' but 'at night'."
678
+ ],
679
+ "fix_hint": "Replace with at (specific times/points), on (days/dates), in (months/years/periods).",
680
+ "british_variant": "'At the weekend' (BrE) vs 'on the weekend' (AmE)."
681
+ },
682
+ {
683
+ "rule_id": "PR_PLC_001",
684
+ "category": "Prepositions",
685
+ "subcategory": "Place Prepositions",
686
+ "title": "Wrong place preposition (at/in/on)",
687
+ "description": "Use 'at' for points/addresses, 'in' for enclosed spaces/areas, 'on' for surfaces.",
688
+ "severity": "warning",
689
+ "language_register": "both",
690
+ "pattern_description": "Match common errors: 'in the bus stop'→'at the bus stop', 'at the room'→'in the room', 'in the table'→'on the table', 'in a chair' (usually 'on').",
691
+ "examples": {
692
+ "incorrect": [
693
+ "I'll meet you in the bus stop.",
694
+ "She is at the bed.",
695
+ "The book is in the table.",
696
+ "He lives at London."
697
+ ],
698
+ "correct": [
699
+ "I'll meet you at the bus stop.",
700
+ "She is in the bed.",
701
+ "The book is on the table.",
702
+ "He lives in London."
703
+ ]
704
+ },
705
+ "exceptions": [
706
+ "'In the car' but 'on the bus/train/plane'. 'At home/work/school' (no 'the')."
707
+ ],
708
+ "fix_hint": "Use 'at' for specific locations/points, 'in' for enclosed areas, 'on' for surfaces.",
709
+ "british_variant": "'In hospital' (BrE) vs 'in the hospital' (AmE)."
710
+ },
711
+ {
712
+ "rule_id": "PR_GER_001",
713
+ "category": "Prepositions",
714
+ "subcategory": "Preposition + Gerund",
715
+ "title": "Preposition followed by infinitive instead of gerund",
716
+ "description": "After prepositions, always use the gerund (-ing form), never the infinitive (to + verb).",
717
+ "severity": "error",
718
+ "language_register": "both",
719
+ "pattern_description": "Regex: /\\b(interested in|good at|afraid of|tired of|capable of|fond of|instead of|in spite of|look forward to|accustomed to|used to|object to|committed to|dedicated to|devoted to|in addition to|prior to|with regard to|insist on|focus on|depend on|rely on|concentrate on|apologize for|responsible for|famous for|known for|apply for|accuse of|approve of|consist of|dream of|think of|talk about|worry about|care about|complain about|forget about|argue about|succeed in|believe in|participate in|result in|specialize in)\\s+to\\s+([a-z]+)\\b/i — where the 'to' leads to a bare infinitive instead of gerund.",
720
+ "examples": {
721
+ "incorrect": [
722
+ "I look forward to meet you.",
723
+ "She is interested in to learn.",
724
+ "He insisted on to go.",
725
+ "Thank you for to help.",
726
+ "I am used to to wake early."
727
+ ],
728
+ "correct": [
729
+ "I look forward to meeting you.",
730
+ "She is interested in learning.",
731
+ "He insisted on going.",
732
+ "Thank you for helping.",
733
+ "I am used to waking early."
734
+ ]
735
+ },
736
+ "exceptions": [
737
+ "'Used to + infinitive' (past habit) is different from 'be used to + gerund' (accustomed to)."
738
+ ],
739
+ "fix_hint": "Replace the infinitive with the -ing form after prepositions.",
740
+ "british_variant": "No significant difference."
741
+ },
742
+ {
743
+ "rule_id": "PR_RED_001",
744
+ "category": "Prepositions",
745
+ "subcategory": "Redundant Prepositions",
746
+ "title": "Redundant preposition with verbs",
747
+ "description": "Some verbs already contain the directional meaning and do not need an additional preposition.",
748
+ "severity": "warning",
749
+ "language_register": "both",
750
+ "pattern_description": "Regex: /\\b(return)\\s+back\\b|\\b(repeat)\\s+again\\b|\\b(revert)\\s+back\\b|\\b(continue)\\s+on\\b|\\b(combine)\\s+together\\b|\\b(connect)\\s+together\\b|\\b(join)\\s+together\\b|\\b(merge)\\s+together\\b|\\b(mix)\\s+together\\b|\\b(penetrate)\\s+into\\b|\\b(rise)\\s+up\\b|\\b(descend)\\s+down\\b|\\b(advance)\\s+forward\\b|\\b(circle)\\s+around\\b|\\b(lift)\\s+up\\b|\\b(raise)\\s+up\\b/i",
751
+ "examples": {
752
+ "incorrect": [
753
+ "Please return back the book.",
754
+ "Could you repeat that again?",
755
+ "Let's revert back to the old version.",
756
+ "They continued on walking.",
757
+ "Mix the ingredients together."
758
+ ],
759
+ "correct": [
760
+ "Please return the book.",
761
+ "Could you repeat that?",
762
+ "Let's revert to the old version.",
763
+ "They continued walking.",
764
+ "Mix the ingredients."
765
+ ]
766
+ },
767
+ "exceptions": [
768
+ "'Repeat again' can be valid when emphasizing doing it a second time. Some are idiomatic and widely accepted."
769
+ ],
770
+ "fix_hint": "Remove the redundant preposition/adverb.",
771
+ "british_variant": "No significant difference."
772
+ },
773
+ {
774
+ "rule_id": "PR_MVR_001",
775
+ "category": "Prepositions",
776
+ "subcategory": "Movement Prepositions",
777
+ "title": "In vs Into confusion",
778
+ "description": "'In' indicates location (being inside). 'Into' indicates movement (going inside).",
779
+ "severity": "warning",
780
+ "language_register": "both",
781
+ "pattern_description": "Match movement verbs (walked, ran, jumped, dove, climbed, went, came, fell, stepped, rushed, stormed, burst, threw) + 'in the' where 'into the' is correct.",
782
+ "examples": {
783
+ "incorrect": [
784
+ "She walked in the room.",
785
+ "He jumped in the pool.",
786
+ "They ran in the building.",
787
+ "The cat climbed in the box."
788
+ ],
789
+ "correct": [
790
+ "She walked into the room.",
791
+ "He jumped into the pool.",
792
+ "They ran into the building.",
793
+ "The cat climbed into the box."
794
+ ]
795
+ },
796
+ "exceptions": [
797
+ "'Walk in the park' (location, not entering). Context determines meaning."
798
+ ],
799
+ "fix_hint": "Use 'into' with movement verbs when indicating entering a space.",
800
+ "british_variant": "No significant difference."
801
+ }
802
+ ]
803
+ }
804
+ ],
805
+ "implementation_notes": {
806
+ "NP": {
807
+ "tokenization": "Pronoun case and reflexive checks are regex-friendly. Antecedent agreement needs NLP coreference resolution for full accuracy.",
808
+ "nlp_requirements": "Use compromise for POS tagging to identify subjects vs objects. Countability requires a lexicon map of uncountable nouns.",
809
+ "regex_applicability": "NP_CAS_001-002, NP_WHO_001, NP_REF_001, NP_CNT_001, NP_PLU_001 are well-suited for regex.",
810
+ "performance": "Build an uncountable nouns Set for O(1) lookup."
811
+ },
812
+ "AD": {
813
+ "tokenization": "Article checks require examining the phonetic onset of the following word — maintain a map of exception words.",
814
+ "nlp_requirements": "Fewer/less and much/many require determining noun countability — use a countable/uncountable lexicon.",
815
+ "regex_applicability": "All AD rules are regex-based. AD_AAN_001 needs a custom check function for phonetic onset.",
816
+ "performance": "Phonetic onset check: maintain Sets for consonant-sounding vowels (uni-, use-, eur-, one) and silent-h words (hour, honest, honor, heir, herb)."
817
+ },
818
+ "AA": {
819
+ "tokenization": "Adjective/adverb distinction requires POS tagging. Participial adjective checks need subject detection.",
820
+ "nlp_requirements": "Use compromise to tag #Adjective vs #Adverb positions. The -ed/-ing check benefits from subject animacy detection.",
821
+ "regex_applicability": "AA_CMP_001, AA_IRR_001, AA_ABS_001, AA_GDW_001 are strongly regex-based. AA_ADV_001 and AA_PAR_001 benefit from NLP.",
822
+ "performance": "Build Sets for absolute adjectives and irregular comparatives."
823
+ },
824
+ "PR": {
825
+ "tokenization": "Preposition collocations are highly regex-friendly — maintain a Map<wrongCollocation, correctCollocation>.",
826
+ "nlp_requirements": "Place preposition checks may benefit from NLP to detect noun type (location vs surface). Time prepositions need date/time entity recognition.",
827
+ "regex_applicability": "All PR rules are well-suited for regex with word-boundary matching.",
828
+ "performance": "Collocation checks should use a single combined regex with alternation for efficiency."
829
+ }
830
+ }
831
+ }