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.
- package/README.npm.md +95 -0
- package/bin/opengrammar-server.js +111 -0
- package/dist/server.js +48639 -0
- package/package.json +80 -0
- package/server-node.ts +159 -0
- package/server.ts +15 -0
- package/src/analyzer.ts +542 -0
- package/src/dictionary.ts +1973 -0
- package/src/index.ts +978 -0
- package/src/nlp/nlp-engine.ts +17 -0
- package/src/nlp/tone-analyzer.ts +269 -0
- package/src/rephraser.ts +146 -0
- package/src/rules/categories/academic-writing.ts +182 -0
- package/src/rules/categories/adjectives-adverbs.ts +152 -0
- package/src/rules/categories/articles.ts +160 -0
- package/src/rules/categories/business-writing.ts +250 -0
- package/src/rules/categories/capitalization.ts +79 -0
- package/src/rules/categories/clarity.ts +117 -0
- package/src/rules/categories/common-errors.ts +601 -0
- package/src/rules/categories/confused-words.ts +219 -0
- package/src/rules/categories/conjunctions.ts +176 -0
- package/src/rules/categories/dangling-modifiers.ts +123 -0
- package/src/rules/categories/formality.ts +274 -0
- package/src/rules/categories/formatting-idioms.ts +323 -0
- package/src/rules/categories/gerund-infinitive.ts +274 -0
- package/src/rules/categories/grammar-advanced.ts +294 -0
- package/src/rules/categories/grammar.ts +286 -0
- package/src/rules/categories/inclusive-language.ts +280 -0
- package/src/rules/categories/nouns-pronouns.ts +233 -0
- package/src/rules/categories/prepositions-extended.ts +217 -0
- package/src/rules/categories/prepositions.ts +159 -0
- package/src/rules/categories/punctuation.ts +347 -0
- package/src/rules/categories/quantity-agreement.ts +200 -0
- package/src/rules/categories/readability.ts +293 -0
- package/src/rules/categories/sentence-structure.ts +100 -0
- package/src/rules/categories/spelling-advanced.ts +164 -0
- package/src/rules/categories/spelling.ts +119 -0
- package/src/rules/categories/style-tone.ts +511 -0
- package/src/rules/categories/style.ts +78 -0
- package/src/rules/categories/subject-verb-agreement.ts +201 -0
- package/src/rules/categories/tone-rules.ts +206 -0
- package/src/rules/categories/verb-tense.ts +582 -0
- package/src/rules/context-filter.ts +446 -0
- package/src/rules/index.ts +96 -0
- package/src/rules/ruleset-part1-cj-pu-sp.json +657 -0
- package/src/rules/ruleset-part1-np-ad-aa-pr.json +831 -0
- package/src/rules/ruleset-part1-ss-vt.json +907 -0
- package/src/rules/ruleset-part2-cw-st-nf.json +318 -0
- package/src/rules/ruleset-part3-aw-bw-il-rd.json +161 -0
- package/src/rules/types.ts +79 -0
- package/src/shared-types.ts +152 -0
- package/src/spellchecker.ts +418 -0
- package/tsconfig.json +25 -0
|
@@ -0,0 +1,657 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "1.0.0",
|
|
3
|
+
"generated_for": "OpenGrammar Engine",
|
|
4
|
+
"part": "1C_of_3",
|
|
5
|
+
"categories": [
|
|
6
|
+
{
|
|
7
|
+
"code": "CJ",
|
|
8
|
+
"name": "Conjunctions & Connectors",
|
|
9
|
+
"rules": [
|
|
10
|
+
{
|
|
11
|
+
"rule_id": "CJ_CRD_001",
|
|
12
|
+
"category": "Conjunctions & Connectors",
|
|
13
|
+
"subcategory": "Coordinating Conjunctions",
|
|
14
|
+
"title": "Missing comma before FANBOYS joining independent clauses",
|
|
15
|
+
"description": "When a coordinating conjunction (for, and, nor, but, or, yet, so) joins two independent clauses, a comma is needed before it.",
|
|
16
|
+
"severity": "warning",
|
|
17
|
+
"language_register": "both",
|
|
18
|
+
"pattern_description": "Detect two clauses (each with subject+verb) joined by FANBOYS without a preceding comma. Requires NLP clause boundary detection.",
|
|
19
|
+
"examples": {
|
|
20
|
+
"incorrect": [
|
|
21
|
+
"She likes coffee but he prefers tea.",
|
|
22
|
+
"I went to the store and I bought milk.",
|
|
23
|
+
"It was raining so we stayed inside."
|
|
24
|
+
],
|
|
25
|
+
"correct": [
|
|
26
|
+
"She likes coffee, but he prefers tea.",
|
|
27
|
+
"I went to the store, and I bought milk.",
|
|
28
|
+
"It was raining, so we stayed inside."
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
"exceptions": [
|
|
32
|
+
"Short closely related clauses: 'I came and I saw.' — comma optional.",
|
|
33
|
+
"When joining only subjects/objects: 'She likes coffee and tea.' — NO comma."
|
|
34
|
+
],
|
|
35
|
+
"fix_hint": "Add a comma before the coordinating conjunction when joining two independent clauses.",
|
|
36
|
+
"british_variant": "No significant difference."
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"rule_id": "CJ_RED_001",
|
|
40
|
+
"category": "Conjunctions & Connectors",
|
|
41
|
+
"subcategory": "Redundant Conjunctions",
|
|
42
|
+
"title": "'Although...but' redundancy",
|
|
43
|
+
"description": "Using both a subordinating conjunction and a coordinating conjunction for the same contrast is redundant.",
|
|
44
|
+
"severity": "warning",
|
|
45
|
+
"language_register": "both",
|
|
46
|
+
"pattern_description": "Regex: /\\b(although|though|even though)\\b[^.]*\\bbut\\b/i, /\\bbecause\\b[^.]*\\bso\\b/i, /\\b(despite|in spite of)\\b[^.]*\\bbut\\b/i",
|
|
47
|
+
"examples": {
|
|
48
|
+
"incorrect": [
|
|
49
|
+
"Although she was tired, but she kept working.",
|
|
50
|
+
"Because it was raining, so we stayed inside.",
|
|
51
|
+
"Despite the delay, but we arrived on time."
|
|
52
|
+
],
|
|
53
|
+
"correct": [
|
|
54
|
+
"Although she was tired, she kept working.",
|
|
55
|
+
"Because it was raining, we stayed inside.",
|
|
56
|
+
"Despite the delay, we arrived on time."
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
"exceptions": [],
|
|
60
|
+
"fix_hint": "Remove one of the two conjunctions — keep the subordinating one or the coordinating one, not both.",
|
|
61
|
+
"british_variant": "No significant difference."
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"rule_id": "CJ_COR_001",
|
|
65
|
+
"category": "Conjunctions & Connectors",
|
|
66
|
+
"subcategory": "Correlative Conjunctions",
|
|
67
|
+
"title": "Correlative conjunction verb agreement",
|
|
68
|
+
"description": "With either...or, neither...nor, the verb agrees with the subject nearest to it.",
|
|
69
|
+
"severity": "error",
|
|
70
|
+
"language_register": "both",
|
|
71
|
+
"pattern_description": "Detect (neither|either) ... (nor|or) patterns and check verb agreement with nearest subject.",
|
|
72
|
+
"examples": {
|
|
73
|
+
"incorrect": [
|
|
74
|
+
"Neither the teacher nor the students was ready.",
|
|
75
|
+
"Either John or the boys has left.",
|
|
76
|
+
"Neither she nor I is going."
|
|
77
|
+
],
|
|
78
|
+
"correct": [
|
|
79
|
+
"Neither the teacher nor the students were ready.",
|
|
80
|
+
"Either John or the boys have left.",
|
|
81
|
+
"Neither she nor I am going."
|
|
82
|
+
]
|
|
83
|
+
},
|
|
84
|
+
"exceptions": [],
|
|
85
|
+
"fix_hint": "Make the verb agree with the subject nearest to it (after nor/or).",
|
|
86
|
+
"british_variant": "No significant difference."
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"rule_id": "CJ_ADV_001",
|
|
90
|
+
"category": "Conjunctions & Connectors",
|
|
91
|
+
"subcategory": "Conjunctive Adverbs",
|
|
92
|
+
"title": "Conjunctive adverb with only a comma",
|
|
93
|
+
"description": "Conjunctive adverbs joining two independent clauses require a semicolon before them (or period + new sentence), plus a comma after.",
|
|
94
|
+
"severity": "error",
|
|
95
|
+
"language_register": "both",
|
|
96
|
+
"pattern_description": "Detect independent clause + comma + conjunctive adverb (however|therefore|moreover|furthermore|consequently|nevertheless|nonetheless|meanwhile|thus|hence|thereby|otherwise|accordingly|similarly|likewise|indeed|instead|still) + independent clause.",
|
|
97
|
+
"examples": {
|
|
98
|
+
"incorrect": [
|
|
99
|
+
"She was tired, however she kept working.",
|
|
100
|
+
"He failed the test, therefore he studied harder.",
|
|
101
|
+
"It rained, consequently we stayed home."
|
|
102
|
+
],
|
|
103
|
+
"correct": [
|
|
104
|
+
"She was tired; however, she kept working.",
|
|
105
|
+
"He failed the test; therefore, he studied harder.",
|
|
106
|
+
"It rained; consequently, we stayed home."
|
|
107
|
+
]
|
|
108
|
+
},
|
|
109
|
+
"exceptions": [
|
|
110
|
+
"When used parenthetically mid-sentence: 'She, however, kept working.' (commas are correct)."
|
|
111
|
+
],
|
|
112
|
+
"fix_hint": "Replace the comma before the conjunctive adverb with a semicolon or period, and add a comma after it.",
|
|
113
|
+
"british_variant": "No significant difference."
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"rule_id": "CJ_RSN_001",
|
|
117
|
+
"category": "Conjunctions & Connectors",
|
|
118
|
+
"subcategory": "Common Conjunction Errors",
|
|
119
|
+
"title": "'The reason is because' redundancy",
|
|
120
|
+
"description": "'The reason is because' is redundant — 'reason' already implies 'because'.",
|
|
121
|
+
"severity": "warning",
|
|
122
|
+
"language_register": "formal",
|
|
123
|
+
"pattern_description": "Regex: /\\bthe\\s+reason\\s+(is|was|being)\\s+because\\b/i",
|
|
124
|
+
"examples": {
|
|
125
|
+
"incorrect": [
|
|
126
|
+
"The reason is because he was late.",
|
|
127
|
+
"The reason was because the system crashed.",
|
|
128
|
+
"The main reason is because costs increased."
|
|
129
|
+
],
|
|
130
|
+
"correct": [
|
|
131
|
+
"The reason is that he was late.",
|
|
132
|
+
"He was late because of the system crash.",
|
|
133
|
+
"The main reason is that costs increased."
|
|
134
|
+
]
|
|
135
|
+
},
|
|
136
|
+
"exceptions": ["Widely used in informal speech. Flag only in formal register."],
|
|
137
|
+
"fix_hint": "Replace 'because' with 'that' after 'the reason is'.",
|
|
138
|
+
"british_variant": "No significant difference."
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"rule_id": "CJ_WRD_001",
|
|
142
|
+
"category": "Conjunctions & Connectors",
|
|
143
|
+
"subcategory": "Wordy Conjunctions",
|
|
144
|
+
"title": "Wordy conjunction replacement",
|
|
145
|
+
"description": "Replace verbose conjunctive phrases with simpler equivalents.",
|
|
146
|
+
"severity": "suggestion",
|
|
147
|
+
"language_register": "both",
|
|
148
|
+
"pattern_description": "Regex: /\\bdue to the fact that\\b/i → 'because', /\\bin spite of the fact that\\b/i → 'although', /\\bregardless of the fact that\\b/i → 'although', /\\bfor the purpose of\\b/i → 'to', /\\bin order to\\b/i → 'to', /\\bin the event that\\b/i → 'if', /\\bin light of the fact that\\b/i → 'because', /\\bwith the exception of\\b/i → 'except'",
|
|
149
|
+
"examples": {
|
|
150
|
+
"incorrect": [
|
|
151
|
+
"Due to the fact that it rained, we stayed.",
|
|
152
|
+
"In spite of the fact that she was tired, she worked.",
|
|
153
|
+
"In the event that you fail, try again."
|
|
154
|
+
],
|
|
155
|
+
"correct": [
|
|
156
|
+
"Because it rained, we stayed.",
|
|
157
|
+
"Although she was tired, she worked.",
|
|
158
|
+
"If you fail, try again."
|
|
159
|
+
]
|
|
160
|
+
},
|
|
161
|
+
"exceptions": ["Some verbose forms are appropriate in legal or very formal writing."],
|
|
162
|
+
"fix_hint": "Replace the verbose phrase with the simpler equivalent.",
|
|
163
|
+
"british_variant": "No significant difference."
|
|
164
|
+
}
|
|
165
|
+
]
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"code": "PU",
|
|
169
|
+
"name": "Punctuation",
|
|
170
|
+
"rules": [
|
|
171
|
+
{
|
|
172
|
+
"rule_id": "PU_COM_001",
|
|
173
|
+
"category": "Punctuation",
|
|
174
|
+
"subcategory": "Comma Rules",
|
|
175
|
+
"title": "Missing comma after introductory element",
|
|
176
|
+
"description": "Place a comma after introductory words, phrases, or clauses.",
|
|
177
|
+
"severity": "warning",
|
|
178
|
+
"language_register": "both",
|
|
179
|
+
"pattern_description": "Match sentence-initial introductory adverbs (However, Therefore, Furthermore, Moreover, Nevertheless, Meanwhile, Consequently, Additionally, Similarly, Accordingly, Unfortunately, Fortunately, Finally, Obviously, Clearly, Actually, Basically, Certainly, Generally, Honestly, Naturally, Personally, Seriously, Technically, Typically, Ultimately) NOT followed by a comma.",
|
|
180
|
+
"examples": {
|
|
181
|
+
"incorrect": [
|
|
182
|
+
"However the plan failed.",
|
|
183
|
+
"Therefore she left early.",
|
|
184
|
+
"Unfortunately we lost.",
|
|
185
|
+
"Meanwhile the storm continued."
|
|
186
|
+
],
|
|
187
|
+
"correct": [
|
|
188
|
+
"However, the plan failed.",
|
|
189
|
+
"Therefore, she left early.",
|
|
190
|
+
"Unfortunately, we lost.",
|
|
191
|
+
"Meanwhile, the storm continued."
|
|
192
|
+
]
|
|
193
|
+
},
|
|
194
|
+
"exceptions": [
|
|
195
|
+
"'However' meaning 'in whatever way': 'However you do it, be careful.' (no comma after however, comma after clause)."
|
|
196
|
+
],
|
|
197
|
+
"fix_hint": "Add a comma after the introductory element.",
|
|
198
|
+
"british_variant": "No significant difference."
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
"rule_id": "PU_COM_002",
|
|
202
|
+
"category": "Punctuation",
|
|
203
|
+
"subcategory": "Comma Rules",
|
|
204
|
+
"title": "Missing comma in direct address",
|
|
205
|
+
"description": "Use a comma to set off names or titles when directly addressing someone.",
|
|
206
|
+
"severity": "warning",
|
|
207
|
+
"language_register": "both",
|
|
208
|
+
"pattern_description": "Match greeting/address word (Thanks, Thank you, Hi, Hello, Hey, Dear, Excuse me, Good morning, Good afternoon, Good evening, Please, Sorry, Yes, No, Well, OK, Okay) + proper noun without comma.",
|
|
209
|
+
"examples": {
|
|
210
|
+
"incorrect": [
|
|
211
|
+
"Thanks John.",
|
|
212
|
+
"Hello Mary how are you?",
|
|
213
|
+
"Please Doctor can you help?",
|
|
214
|
+
"Hey Mike come here."
|
|
215
|
+
],
|
|
216
|
+
"correct": [
|
|
217
|
+
"Thanks, John.",
|
|
218
|
+
"Hello, Mary, how are you?",
|
|
219
|
+
"Please, Doctor, can you help?",
|
|
220
|
+
"Hey, Mike, come here."
|
|
221
|
+
]
|
|
222
|
+
},
|
|
223
|
+
"exceptions": [],
|
|
224
|
+
"fix_hint": "Add commas around the name/title being addressed.",
|
|
225
|
+
"british_variant": "No significant difference."
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
"rule_id": "PU_APO_001",
|
|
229
|
+
"category": "Punctuation",
|
|
230
|
+
"subcategory": "Apostrophe Errors",
|
|
231
|
+
"title": "its vs it's confusion",
|
|
232
|
+
"description": "'It's' = 'it is' or 'it has'. 'Its' = possessive (belonging to it). Never use 'its'' (with trailing apostrophe).",
|
|
233
|
+
"severity": "error",
|
|
234
|
+
"language_register": "both",
|
|
235
|
+
"pattern_description": "Detect 'its' before a verb (been, is, going, raining, etc.) where 'it's' is needed. Detect 'it's' before a noun where possessive 'its' is needed: 'it's color', 'it's purpose', 'it's role'.",
|
|
236
|
+
"examples": {
|
|
237
|
+
"incorrect": [
|
|
238
|
+
"Its raining outside.",
|
|
239
|
+
"Its been a long day.",
|
|
240
|
+
"The dog wagged it's tail.",
|
|
241
|
+
"It's color is blue."
|
|
242
|
+
],
|
|
243
|
+
"correct": [
|
|
244
|
+
"It's raining outside.",
|
|
245
|
+
"It's been a long day.",
|
|
246
|
+
"The dog wagged its tail.",
|
|
247
|
+
"Its color is blue."
|
|
248
|
+
]
|
|
249
|
+
},
|
|
250
|
+
"exceptions": [],
|
|
251
|
+
"fix_hint": "If you can replace with 'it is' or 'it has', use 'it's'. Otherwise, use 'its' (no apostrophe).",
|
|
252
|
+
"british_variant": "No significant difference."
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
"rule_id": "PU_APO_002",
|
|
256
|
+
"category": "Punctuation",
|
|
257
|
+
"subcategory": "Apostrophe Errors",
|
|
258
|
+
"title": "your vs you're confusion",
|
|
259
|
+
"description": "'You're' = 'you are'. 'Your' = possessive (belonging to you).",
|
|
260
|
+
"severity": "error",
|
|
261
|
+
"language_register": "both",
|
|
262
|
+
"pattern_description": "Detect 'your' before adjective/adverb describing the listener ('your welcome', 'your right', 'your wrong', 'your amazing', 'your going'). Detect 'you're' before a noun where 'your' is needed ('you're house', 'you're car', 'you're book').",
|
|
263
|
+
"examples": {
|
|
264
|
+
"incorrect": [
|
|
265
|
+
"Your welcome.",
|
|
266
|
+
"Your going to love this.",
|
|
267
|
+
"Your the best.",
|
|
268
|
+
"You're house is nice."
|
|
269
|
+
],
|
|
270
|
+
"correct": [
|
|
271
|
+
"You're welcome.",
|
|
272
|
+
"You're going to love this.",
|
|
273
|
+
"You're the best.",
|
|
274
|
+
"Your house is nice."
|
|
275
|
+
]
|
|
276
|
+
},
|
|
277
|
+
"exceptions": [],
|
|
278
|
+
"fix_hint": "If you can replace with 'you are', use 'you're'. Otherwise 'your'.",
|
|
279
|
+
"british_variant": "No significant difference."
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
"rule_id": "PU_APO_003",
|
|
283
|
+
"category": "Punctuation",
|
|
284
|
+
"subcategory": "Apostrophe Errors",
|
|
285
|
+
"title": "their/they're/there confusion",
|
|
286
|
+
"description": "'They're' = 'they are'. 'Their' = possessive. 'There' = location/existential.",
|
|
287
|
+
"severity": "error",
|
|
288
|
+
"language_register": "both",
|
|
289
|
+
"pattern_description": "Detect 'their' + verb (going, coming, working) → 'they're'. Detect 'there' + possessive context ('there house') → 'their'. Detect 'they're' + noun ('they're house') → 'their'.",
|
|
290
|
+
"examples": {
|
|
291
|
+
"incorrect": [
|
|
292
|
+
"Their going to the store.",
|
|
293
|
+
"There house is big.",
|
|
294
|
+
"They're car is red.",
|
|
295
|
+
"Look over their."
|
|
296
|
+
],
|
|
297
|
+
"correct": [
|
|
298
|
+
"They're going to the store.",
|
|
299
|
+
"Their house is big.",
|
|
300
|
+
"Their car is red.",
|
|
301
|
+
"Look over there."
|
|
302
|
+
]
|
|
303
|
+
},
|
|
304
|
+
"exceptions": [],
|
|
305
|
+
"fix_hint": "'they are' = they're, 'belonging to them' = their, 'that place' = there.",
|
|
306
|
+
"british_variant": "No significant difference."
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
"rule_id": "PU_APO_004",
|
|
310
|
+
"category": "Punctuation",
|
|
311
|
+
"subcategory": "Apostrophe Errors",
|
|
312
|
+
"title": "Apostrophe in simple plurals",
|
|
313
|
+
"description": "Never use an apostrophe to form a regular plural noun.",
|
|
314
|
+
"severity": "error",
|
|
315
|
+
"language_register": "both",
|
|
316
|
+
"pattern_description": "Regex: /\\b([A-Za-z]+)'s\\b/ where the word is a regular plural context (not possessive). Detect patterns like 'apple's for sale', 'the dog's are barking', 'DVD's', '1990's'.",
|
|
317
|
+
"examples": {
|
|
318
|
+
"incorrect": [
|
|
319
|
+
"Apple's for sale.",
|
|
320
|
+
"The dog's are barking.",
|
|
321
|
+
"She has many CD's.",
|
|
322
|
+
"I love the 1990's."
|
|
323
|
+
],
|
|
324
|
+
"correct": [
|
|
325
|
+
"Apples for sale.",
|
|
326
|
+
"The dogs are barking.",
|
|
327
|
+
"She has many CDs.",
|
|
328
|
+
"I love the 1990s."
|
|
329
|
+
]
|
|
330
|
+
},
|
|
331
|
+
"exceptions": [
|
|
332
|
+
"Apostrophes in plurals of single letters: 'Mind your p's and q's.' Decades: '1990's' is acceptable in some style guides."
|
|
333
|
+
],
|
|
334
|
+
"fix_hint": "Remove the apostrophe — use plain -s for plurals.",
|
|
335
|
+
"british_variant": "No significant difference."
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
"rule_id": "PU_SEM_001",
|
|
339
|
+
"category": "Punctuation",
|
|
340
|
+
"subcategory": "Semicolon",
|
|
341
|
+
"title": "Semicolon joining independent clauses",
|
|
342
|
+
"description": "A semicolon joins two closely related independent clauses without a conjunction.",
|
|
343
|
+
"severity": "suggestion",
|
|
344
|
+
"language_register": "formal",
|
|
345
|
+
"pattern_description": "Detect two independent clauses separated by a period where a semicolon might improve flow, or comma splices that should use a semicolon.",
|
|
346
|
+
"examples": {
|
|
347
|
+
"incorrect": [
|
|
348
|
+
"She likes coffee, he prefers tea.",
|
|
349
|
+
"The project failed, the budget was exceeded."
|
|
350
|
+
],
|
|
351
|
+
"correct": [
|
|
352
|
+
"She likes coffee; he prefers tea.",
|
|
353
|
+
"The project failed; the budget was exceeded."
|
|
354
|
+
]
|
|
355
|
+
},
|
|
356
|
+
"exceptions": ["When clauses are not closely related, use a period instead."],
|
|
357
|
+
"fix_hint": "Replace the comma with a semicolon, or add a coordinating conjunction after the comma.",
|
|
358
|
+
"british_variant": "No significant difference."
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
"rule_id": "PU_HYP_001",
|
|
362
|
+
"category": "Punctuation",
|
|
363
|
+
"subcategory": "Hyphenation",
|
|
364
|
+
"title": "Missing hyphen in compound adjective before noun",
|
|
365
|
+
"description": "Compound adjectives before a noun should be hyphenated.",
|
|
366
|
+
"severity": "suggestion",
|
|
367
|
+
"language_register": "formal",
|
|
368
|
+
"pattern_description": "Match common compound adjectives without hyphens: 'well known author'→'well-known author', 'high quality product'→'high-quality product', 'long term plan'→'long-term plan', 'full time job'→'full-time job', 'part time work'→'part-time work', 'state of the art technology'→'state-of-the-art technology', 'up to date information'→'up-to-date information', 'real time data'→'real-time data'.",
|
|
369
|
+
"examples": {
|
|
370
|
+
"incorrect": [
|
|
371
|
+
"A well known author.",
|
|
372
|
+
"A high quality product.",
|
|
373
|
+
"A long term plan.",
|
|
374
|
+
"A full time job."
|
|
375
|
+
],
|
|
376
|
+
"correct": [
|
|
377
|
+
"A well-known author.",
|
|
378
|
+
"A high-quality product.",
|
|
379
|
+
"A long-term plan.",
|
|
380
|
+
"A full-time job."
|
|
381
|
+
]
|
|
382
|
+
},
|
|
383
|
+
"exceptions": [
|
|
384
|
+
"After the noun: 'The author is well known.' (no hyphen). Adverb ending -ly: 'a beautifully designed room' (no hyphen)."
|
|
385
|
+
],
|
|
386
|
+
"fix_hint": "Add hyphens between the words forming the compound adjective when it precedes the noun.",
|
|
387
|
+
"british_variant": "No significant difference."
|
|
388
|
+
}
|
|
389
|
+
]
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
"code": "SP",
|
|
393
|
+
"name": "Spelling Rules",
|
|
394
|
+
"rules": [
|
|
395
|
+
{
|
|
396
|
+
"rule_id": "SP_COM_001",
|
|
397
|
+
"category": "Spelling Rules",
|
|
398
|
+
"subcategory": "Commonly Misspelled Words",
|
|
399
|
+
"title": "Top 100 misspelled words",
|
|
400
|
+
"description": "A dictionary of the most commonly misspelled English words.",
|
|
401
|
+
"severity": "error",
|
|
402
|
+
"language_register": "both",
|
|
403
|
+
"pattern_description": "Word-boundary regex match for each misspelling → correct form. Includes: accommodate, acquire, argument, beginning, believe, bizarre, calendar, Caribbean, cemetery, committee, conscious, conscience, definitely, dilemma, embarrass, equivalent, exaggerate, existence, foreign, guarantee, harass, hierarchy, humorous, immediately, independent, indispensable, liaison, maintenance, millennium, miniature, miscellaneous, necessary, noticeable, occasionally, occurrence, parallel, perceive, perseverance, personnel, possession, privilege, receive, recommend, referred, relevant, resistance, restaurant, rhythm, schedule, separate, sergeant, similar, sincerely, subtle, supersede, surprise, tendency, threshold, tomorrow, unnecessary, vacuum, Wednesday, weird.",
|
|
404
|
+
"examples": {
|
|
405
|
+
"incorrect": [
|
|
406
|
+
"accomodate",
|
|
407
|
+
"arguement",
|
|
408
|
+
"bizzare",
|
|
409
|
+
"calender",
|
|
410
|
+
"cemetary",
|
|
411
|
+
"committie",
|
|
412
|
+
"concious",
|
|
413
|
+
"definately",
|
|
414
|
+
"embarass",
|
|
415
|
+
"existance",
|
|
416
|
+
"foriegn",
|
|
417
|
+
"guarentee",
|
|
418
|
+
"harrass",
|
|
419
|
+
"hierarcy",
|
|
420
|
+
"independant",
|
|
421
|
+
"liason",
|
|
422
|
+
"maintainance",
|
|
423
|
+
"millenium",
|
|
424
|
+
"neccessary",
|
|
425
|
+
"occassion",
|
|
426
|
+
"paralell",
|
|
427
|
+
"percieve",
|
|
428
|
+
"possesion",
|
|
429
|
+
"priviledge",
|
|
430
|
+
"recieve",
|
|
431
|
+
"recomend",
|
|
432
|
+
"relevent",
|
|
433
|
+
"restuarant",
|
|
434
|
+
"rythm",
|
|
435
|
+
"seperate"
|
|
436
|
+
],
|
|
437
|
+
"correct": [
|
|
438
|
+
"accommodate",
|
|
439
|
+
"argument",
|
|
440
|
+
"bizarre",
|
|
441
|
+
"calendar",
|
|
442
|
+
"cemetery",
|
|
443
|
+
"committee",
|
|
444
|
+
"conscious",
|
|
445
|
+
"definitely",
|
|
446
|
+
"embarrass",
|
|
447
|
+
"existence",
|
|
448
|
+
"foreign",
|
|
449
|
+
"guarantee",
|
|
450
|
+
"harass",
|
|
451
|
+
"hierarchy",
|
|
452
|
+
"independent",
|
|
453
|
+
"liaison",
|
|
454
|
+
"maintenance",
|
|
455
|
+
"millennium",
|
|
456
|
+
"necessary",
|
|
457
|
+
"occasion",
|
|
458
|
+
"parallel",
|
|
459
|
+
"perceive",
|
|
460
|
+
"possession",
|
|
461
|
+
"privilege",
|
|
462
|
+
"receive",
|
|
463
|
+
"recommend",
|
|
464
|
+
"relevant",
|
|
465
|
+
"restaurant",
|
|
466
|
+
"rhythm",
|
|
467
|
+
"separate"
|
|
468
|
+
]
|
|
469
|
+
},
|
|
470
|
+
"exceptions": [],
|
|
471
|
+
"fix_hint": "Replace with correct spelling.",
|
|
472
|
+
"british_variant": "See SP_BRA_001 for British/American spelling differences."
|
|
473
|
+
},
|
|
474
|
+
{
|
|
475
|
+
"rule_id": "SP_BRA_001",
|
|
476
|
+
"category": "Spelling Rules",
|
|
477
|
+
"subcategory": "British vs American Spelling",
|
|
478
|
+
"title": "British/American spelling variant detection",
|
|
479
|
+
"description": "Detect and flag when British and American spellings are mixed within the same document.",
|
|
480
|
+
"severity": "suggestion",
|
|
481
|
+
"language_register": "both",
|
|
482
|
+
"pattern_description": "Track occurrences of variant pairs: -our/-or (colour/color, favour/favor, honour/honor, humour/humor, labour/labor, neighbour/neighbor, behaviour/behavior), -re/-er (centre/center, theatre/theater, metre/meter, fibre/fiber, litre/liter, lustre/luster, sombre/somber), -ise/-ize (organise/organize, realise/realize, recognise/recognize, specialise/specialize, analyse/analyze), -ence/-ense (defence/defense, licence/license, offence/offense, pretence/pretense), -ogue/-og (catalogue/catalog, dialogue/dialog, analogue/analog), double/single consonant (travelled/traveled, cancelled/canceled, modelling/modeling, labelled/labeled, counsellor/counselor, jewellery/jewelry), -ae/-e (anaemia/anemia, orthopaedic/orthopedic, paediatric/pediatric). Flag when document contains both variants.",
|
|
483
|
+
"examples": {
|
|
484
|
+
"incorrect": [
|
|
485
|
+
"The colour of the center was nice.",
|
|
486
|
+
"She travelled to the theater.",
|
|
487
|
+
"He organised the defense plan."
|
|
488
|
+
],
|
|
489
|
+
"correct": [
|
|
490
|
+
"The color of the center was nice. (AmE)",
|
|
491
|
+
"The colour of the centre was nice. (BrE)",
|
|
492
|
+
"He organized the defense plan. (AmE)"
|
|
493
|
+
]
|
|
494
|
+
},
|
|
495
|
+
"exceptions": [
|
|
496
|
+
"Proper nouns: 'Defence Ministry' or 'Department of Defense' — preserve as-is. Direct quotes preserve original spelling."
|
|
497
|
+
],
|
|
498
|
+
"fix_hint": "Maintain consistency: detect which variant is dominant in the document and flag exceptions.",
|
|
499
|
+
"british_variant": "This rule specifically handles British/American differences."
|
|
500
|
+
},
|
|
501
|
+
{
|
|
502
|
+
"rule_id": "SP_DBL_001",
|
|
503
|
+
"category": "Spelling Rules",
|
|
504
|
+
"subcategory": "Doubling Consonants",
|
|
505
|
+
"title": "Incorrect consonant doubling",
|
|
506
|
+
"description": "When adding a vowel suffix, double the final consonant only if the word ends CVC AND has stress on the final syllable.",
|
|
507
|
+
"severity": "error",
|
|
508
|
+
"language_register": "both",
|
|
509
|
+
"pattern_description": "Wrong doubles: writting→writing, begining→beginning, occured→occurred, refered→referred, comming→coming, openning→opening, happenning→happening, developped→developed, occuring→occurring, prefered→preferred, benefitting→benefiting (AmE), cancelling→canceling (AmE). Wrong singles: runing→running, siting→sitting, planing→planning, stoping→stopping, shoping→shopping, droping→dropping, geting→getting, puting→putting, cuting→cutting, hiting→hitting.",
|
|
510
|
+
"examples": {
|
|
511
|
+
"incorrect": [
|
|
512
|
+
"She was writting a letter.",
|
|
513
|
+
"The event is occuring now.",
|
|
514
|
+
"He refered to the manual.",
|
|
515
|
+
"She is runing fast.",
|
|
516
|
+
"They are planing a trip."
|
|
517
|
+
],
|
|
518
|
+
"correct": [
|
|
519
|
+
"She was writing a letter.",
|
|
520
|
+
"The event is occurring now.",
|
|
521
|
+
"He referred to the manual.",
|
|
522
|
+
"She is running fast.",
|
|
523
|
+
"They are planning a trip."
|
|
524
|
+
]
|
|
525
|
+
},
|
|
526
|
+
"exceptions": [
|
|
527
|
+
"British English doubles more consonants: travelled, cancelled, modelling (vs American: traveled, canceled, modeling)."
|
|
528
|
+
],
|
|
529
|
+
"fix_hint": "Check the stress pattern and final consonant to determine whether to double.",
|
|
530
|
+
"british_variant": "British English doubles final consonant in more words: travelled, modelled, cancelled."
|
|
531
|
+
},
|
|
532
|
+
{
|
|
533
|
+
"rule_id": "SP_IEE_001",
|
|
534
|
+
"category": "Spelling Rules",
|
|
535
|
+
"subcategory": "IE/EI Rule",
|
|
536
|
+
"title": "I before E rule violations",
|
|
537
|
+
"description": "I before E except after C, or when sounded as 'ay' (as in neighbor, weigh).",
|
|
538
|
+
"severity": "error",
|
|
539
|
+
"language_register": "both",
|
|
540
|
+
"pattern_description": "Match common errors: recieve→receive, beleive→believe, acheive→achieve, concieve→conceive, decieve→deceive, percieve→perceive, wierd→weird, nieghbor→neighbor, foriegn→foreign, seize (correct, exception to rule), their (correct, 'ay' sound).",
|
|
541
|
+
"examples": {
|
|
542
|
+
"incorrect": [
|
|
543
|
+
"I beleive you.",
|
|
544
|
+
"She will recieve it.",
|
|
545
|
+
"They acheived their goals.",
|
|
546
|
+
"That's wierd.",
|
|
547
|
+
"Don't decieve me."
|
|
548
|
+
],
|
|
549
|
+
"correct": [
|
|
550
|
+
"I believe you.",
|
|
551
|
+
"She will receive it.",
|
|
552
|
+
"They achieved their goals.",
|
|
553
|
+
"That's weird.",
|
|
554
|
+
"Don't deceive me."
|
|
555
|
+
]
|
|
556
|
+
},
|
|
557
|
+
"exceptions": [
|
|
558
|
+
"weird, seize, either, neither, foreign, leisure, protein, caffeine, species, science, sufficient, ancient, glacier, society — numerous exceptions exist."
|
|
559
|
+
],
|
|
560
|
+
"fix_hint": "Apply i-before-e rule, but check the exceptions list.",
|
|
561
|
+
"british_variant": "No significant difference."
|
|
562
|
+
},
|
|
563
|
+
{
|
|
564
|
+
"rule_id": "SP_SIL_001",
|
|
565
|
+
"category": "Spelling Rules",
|
|
566
|
+
"subcategory": "Silent E Rule",
|
|
567
|
+
"title": "Silent E errors with suffixes",
|
|
568
|
+
"description": "Drop silent 'e' before a vowel suffix (-ing, -able, -ous, -ation), keep before consonant suffix (-ment, -ful, -less, -ness).",
|
|
569
|
+
"severity": "error",
|
|
570
|
+
"language_register": "both",
|
|
571
|
+
"pattern_description": "Wrong: makeing→making, hopeing→hoping, useing→using, moveing→moving, liveing→living, writeing→writing, loveable→lovable, arguement→argument, truely→truly, nineth→ninth, judgement→judgment (AmE). Correct: hopeful (keep e), movement (keep e), useful (keep e), barely (keep e).",
|
|
572
|
+
"examples": {
|
|
573
|
+
"incorrect": [
|
|
574
|
+
"She is makeing dinner.",
|
|
575
|
+
"They were hopeing for rain.",
|
|
576
|
+
"That is truely amazing.",
|
|
577
|
+
"She is useing the computer."
|
|
578
|
+
],
|
|
579
|
+
"correct": [
|
|
580
|
+
"She is making dinner.",
|
|
581
|
+
"They were hoping for rain.",
|
|
582
|
+
"That is truly amazing.",
|
|
583
|
+
"She is using the computer."
|
|
584
|
+
]
|
|
585
|
+
},
|
|
586
|
+
"exceptions": [
|
|
587
|
+
"Keep 'e' after soft c/g: noticeable, changeable, manageable, courageous. 'Judgement' accepted in British English."
|
|
588
|
+
],
|
|
589
|
+
"fix_hint": "Drop the 'e' before vowel suffixes; keep before consonant suffixes (with noted exceptions).",
|
|
590
|
+
"british_variant": "'Judgement' is standard in British English. 'Ageing' (BrE) vs 'aging' (AmE)."
|
|
591
|
+
},
|
|
592
|
+
{
|
|
593
|
+
"rule_id": "SP_YTI_001",
|
|
594
|
+
"category": "Spelling Rules",
|
|
595
|
+
"subcategory": "Y to I Rule",
|
|
596
|
+
"title": "Y to I conversion errors",
|
|
597
|
+
"description": "When a word ends in consonant + y, change y to i before most suffixes (but keep y before -ing).",
|
|
598
|
+
"severity": "error",
|
|
599
|
+
"language_register": "both",
|
|
600
|
+
"pattern_description": "Wrong: happyer→happier, easyer→easier, beautyfull→beautiful, partys→parties, familys→families, carryed→carried, tryed→tried, studyed→studied, cryed→cried, replyed→replied, applyed→applied. Keep y: studying (not studing), carrying (not carriing), trying (not triing), playing (not plaiing — vowel + y stays).",
|
|
601
|
+
"examples": {
|
|
602
|
+
"incorrect": [
|
|
603
|
+
"She is happyer now.",
|
|
604
|
+
"Those are the best partys.",
|
|
605
|
+
"He carryed the box.",
|
|
606
|
+
"She tryed her best.",
|
|
607
|
+
"The babys are sleeping."
|
|
608
|
+
],
|
|
609
|
+
"correct": [
|
|
610
|
+
"She is happier now.",
|
|
611
|
+
"Those are the best parties.",
|
|
612
|
+
"He carried the box.",
|
|
613
|
+
"She tried her best.",
|
|
614
|
+
"The babies are sleeping."
|
|
615
|
+
]
|
|
616
|
+
},
|
|
617
|
+
"exceptions": [
|
|
618
|
+
"Vowel + y: stays as is (played, keys, donkeys). Before -ing: keep y (studying, carrying). Proper nouns (the Kennedys, not Kennedies)."
|
|
619
|
+
],
|
|
620
|
+
"fix_hint": "Change consonant + y to i before suffixes other than -ing.",
|
|
621
|
+
"british_variant": "No significant difference."
|
|
622
|
+
}
|
|
623
|
+
]
|
|
624
|
+
}
|
|
625
|
+
],
|
|
626
|
+
"implementation_notes": {
|
|
627
|
+
"CJ": {
|
|
628
|
+
"tokenization": "Conjunction errors are mix of regex (redundancy, wordy) and NLP (clause boundary detection for comma rules).",
|
|
629
|
+
"nlp_requirements": "CJ_CRD_001 needs clause boundary detection. CJ_COR_001 needs nearest-subject agreement checking.",
|
|
630
|
+
"regex_applicability": "CJ_RED_001, CJ_RSN_001, CJ_WRD_001 are purely regex-based. CJ_ADV_001 can use regex with clause heuristics.",
|
|
631
|
+
"performance": "Combine wordy conjunction patterns into a single alternation regex for efficiency."
|
|
632
|
+
},
|
|
633
|
+
"PU": {
|
|
634
|
+
"tokenization": "Punctuation checks operate at character level. Split text preserving all whitespace and punctuation.",
|
|
635
|
+
"nlp_requirements": "Comma rules need clause detection. Apostrophe rules are regex-based with POS context.",
|
|
636
|
+
"regex_applicability": "Most PU rules are regex-based. PU_COM_001, PU_APO_001-004 are excellent regex candidates.",
|
|
637
|
+
"performance": "Apostrophe checks should run early — they're fast and high-value for user satisfaction."
|
|
638
|
+
},
|
|
639
|
+
"SP": {
|
|
640
|
+
"tokenization": "Spelling checks use word-boundary matching. Build a HashMap<misspelling, correction> for O(1) lookup.",
|
|
641
|
+
"nlp_requirements": "SP_BRA_001 needs document-level analysis to detect dominant spelling variant. All others are word-level.",
|
|
642
|
+
"regex_applicability": "All SP rules are regex-based. SP_COM_001 should use a compiled map of 200+ entries.",
|
|
643
|
+
"performance": "Compile all misspellings into a single Trie or Set for efficient scanning. For long documents, process in chunks."
|
|
644
|
+
},
|
|
645
|
+
"general_architecture": {
|
|
646
|
+
"rule_loading": "Load all JSON rules at startup, compile regex patterns once, store in typed Rule[] arrays.",
|
|
647
|
+
"priority_order": "Process rules in order: spelling > grammar > clarity > style. Within each, errors before warnings before suggestions.",
|
|
648
|
+
"deduplication": "When multiple rules flag the same text span, keep the highest-severity match only.",
|
|
649
|
+
"codebase_mapping": {
|
|
650
|
+
"regex_rules": "Use createRegexRule() helper from types.ts for all pattern-based rules.",
|
|
651
|
+
"nlp_rules": "Use NLPRule interface with compromise doc parameter for POS-dependent rules.",
|
|
652
|
+
"custom_check_rules": "Use RegexRule with custom check() function for complex logic (article a/an, comma splices, sentence fragments).",
|
|
653
|
+
"category_files": "Create new files in src/rules/categories/ for each code: sentence-structure.ts, verb-tense.ts, nouns-pronouns.ts, articles-determiners.ts, adjectives-adverbs.ts, prepositions.ts, conjunctions.ts, punctuation.ts, spelling-patterns.ts"
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
}
|