feat: add call for grammar rule contributors and new rule template

Swadhin Biswas committed 7 months ago
7b8df26
1 parent b9ec4ea
commit 7b8df26
3 files changed
+113 -3
β–Ό.github/ISSUE_TEMPLATE/rule_suggestion.yml
+38-0
1
+name: Grammar Rule Suggestion
2
+description: Suggest a new grammar, spelling, or style rule for OpenGrammar.
3
+title: "[RULE] "
4
+labels: ["enhancement", "grammar-rule"]
5
+body:
6
+ - type: markdown
7
+ attributes:
8
+ value: |
9
+ Help us expand our local rule library!
10
+ - type: textarea
11
+ id: mistake
12
+ attributes:
13
+ label: Incorrect Text
14
+ description: What is the mistake or the phrase to be improved?
15
+ placeholder: Ex. "at this point in time"
16
+ validations:
17
+ required: true
18
+ - type: textarea
19
+ id: correction
20
+ attributes:
21
+ label: Suggested Correction
22
+ description: What should it be changed to?
23
+ placeholder: Ex. "now"
24
+ validations:
25
+ required: true
26
+ - type: textarea
27
+ id: reason
28
+ attributes:
29
+ label: Reason / Explanation
30
+ description: Why is this an error or how does the change improve the writing?
31
+ placeholder: Ex. "Redundant phrase. 'Now' is more concise."
32
+ validations:
33
+ required: true
34
+ - type: textarea
35
+ id: examples
36
+ attributes:
37
+ label: Example Sentences
38
+ description: Provide one or two sentences showing the rule in action.
0
39
β–ΌGRAMMAR_RULES.md
+66-0
1
+# πŸ“š Contributing Grammar Rules
2
+
3
+We want to build the most comprehensive open-source library of grammar and style rules. This guide explains how you can contribute new rules to OpenGrammar.
4
+
5
+## How Rules Work
6
+
7
+OpenGrammar uses a "Rule-Based Engine" for fast, offline analysis. These rules are defined using **Regular Expressions (RegEx)**.
8
+
9
+The rules are located in: `opengrammar/backend/src/analyzer-simple.ts`
10
+
11
+### Structure of a Rule
12
+
13
+Each rule consists of:
14
+1. **Pattern:** A RegEx to find the issue.
15
+2. **Suggestion:** The text that should replace the error.
16
+3. **Reason:** An explanation of why this is an error.
17
+
18
+### Example: Common Misspelling
19
+
20
+```typescript
21
+{
22
+ pattern: /\bteh\b/gi,
23
+ suggestion: 'the',
24
+ reason: 'Misspelled word. The correct spelling is "the".'
25
+}
26
+```
27
+
28
+## How to Contribute a Rule
29
+
30
+You don't need to be an expert developer to contribute!
31
+
32
+### Option 1: Open an Issue (Non-Developers)
33
+If you know a common mistake but don't want to touch the code:
34
+1. Go to the **Issues** tab.
35
+2. Choose the **"Grammar Rule Suggestion"** template.
36
+3. Provide the incorrect text, the correction, and the reason.
37
+
38
+### Option 2: Submit a Pull Request (Developers)
39
+1. Open `opengrammar/backend/src/analyzer-simple.ts`.
40
+2. Find the relevant category (e.g., `checkBasicGrammar`, `checkCommonMisspellings`).
41
+3. Add your rule to the array.
42
+4. Run `bun x tsc` to ensure no syntax errors.
43
+5. Submit your PR!
44
+
45
+## Categories of Rules Needed
46
+
47
+We are looking for rules in the following categories:
48
+
49
+### 1. Common Misspellings
50
+Words that are frequently typed incorrectly (e.g., "recieve" β†’ "receive").
51
+
52
+### 2. Confused Words
53
+Words that sound similar but have different meanings (e.g., "affect" vs "effect").
54
+
55
+### 3. Redundant Phrases
56
+Wordy phrases that can be simplified (e.g., "at this point in time" β†’ "now").
57
+
58
+### 4. Style & Clarity
59
+Rules that help make writing more professional (e.g., avoiding excessive use of "very").
60
+
61
+### 5. Punctuation & Spacing
62
+Common errors with commas, apostrophes, and double spaces.
63
+
64
+---
65
+
66
+**Thank you for helping us make OpenGrammar better for everyone!**
0
67
β–ΌREADME.md
+9-3
92
92
93
93
This will create a `dist/` folder. Load this folder into Chrome following the user instructions above.
94
94
95
-## 🀝 Contributing
95
+## 🀝 Contributing & Help Needed
96
96
97
-OpenGrammar is a community effort! Whether you want to add new local grammar rules, improve the highlighting logic in rich text editors, or fix bugs, we welcome your contributions.
97
+**We need your help to make OpenGrammar the best open-source writing assistant!**
98
98
99
-Please check out our `ROADMAP.md` to see what we are currently working on.
99
+One of our primary goals is to build the most comprehensive library of local (offline) grammar and style rules. You don't need to be a developer to helpβ€”if you have a good eye for grammar, you can contribute!
100
+
101
+- **πŸ“š Add Grammar Rules:** Help us expand our `analyzer-simple.ts` with more regex-based rules for common mistakes, style improvements, and clarity checks. See [GRAMMAR_RULES.md](./GRAMMAR_RULES.md) for a guide on how to add them.
102
+- **πŸ› Report Bugs:** Found a website where the highlighting is wonky? Open an issue!
103
+- **πŸ’‘ Suggest Features:** Have an idea for a cool new feature? Let's discuss it in the Discussions tab.
104
+
105
+Please check out our [CONTRIBUTING.md](./CONTRIBUTING.md) and `ROADMAP.md` for more details.
100
106
101
107
## πŸ“„ License
102
108
103
109