youssefreda9 commited on
Commit
043bada
·
1 Parent(s): 9afb00f

Phase 11: Add Finding 7 - Spelling ORTHO_PAIRS blocks keyboard typos

Browse files

Real-world case: بالرفم→بالرغم (ف→غ) blocked by _is_small_spelling_change()
because ف↔غ is not in ORTHO_PAIRS.

The spelling model CORRECTLY detects the fix, but the filter
rejects it as a 'root change' instead of recognizing it as a
keyboard-adjacent typo.

Added Priority 6 recommendation: add keyboard-adjacent pairs
to ORTHO_PAIRS (Option A) or separate KEYBOARD_TYPO_PAIRS with
dampened confidence (Option B).

tests/phase11/reports/phase11_summary.md CHANGED
@@ -99,11 +99,27 @@ G028: `يفعلون` → `يفعلوَ` (fatha on waw)
99
 
100
  The model produces the correct ROOT form but adds a diacritical that makes it fail the IVtoOOV vocabulary check. The diacritical should be stripped before the vocab check.
101
 
102
- ### Finding 6: Grammar model top failure modes
103
 
104
- 1. **Returns unchanged** for أسماء الخمسة (five nouns): G022 `أخوك` should be `أخاك`
105
- 2. **Wrong suffix**: G003 `حضرون` instead of `حضروا` (present tense suffix instead of past tense)
106
- 3. **Diacritical pollution**: G006, G028 — adds فتحة to جزم corrections
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
 
108
  ---
109
 
@@ -133,8 +149,21 @@ StageLocker caused 1 rejection in 270 samples. It is functioning correctly.
133
 
134
  Zero conflicts in 270 samples. No architectural change needed.
135
 
 
 
 
 
 
 
 
 
 
 
 
 
136
  ### Not Recommended
137
 
138
  - Adding NER — entity FP (3 cases) are minor compared to grammar issues
139
  - Replacing grammar model — the model IS producing correct corrections for most patterns
140
  - Redesigning OffsetMapper — edge case documented but not causing failures
 
 
99
 
100
  The model produces the correct ROOT form but adds a diacritical that makes it fail the IVtoOOV vocabulary check. The diacritical should be stripped before the vocab check.
101
 
102
+ ### Finding 7: Spelling ORTHO_PAIRS blocks genuine keyboard typos
103
 
104
+ **Real-world case**: `بالرفم`→`بالرغم` (ف→غ, "despite")
105
+
106
+ The spelling model correctly detects the fix. But `_is_small_spelling_change()` rejects it because:
107
+ - Path 1 (IV-IV guard): Both words are valid Arabic → only known orthographic fixes allowed → ف↔غ NOT in ORTHO_PAIRS → **REJECT**
108
+ - Path 2 (OOV path): Character check at line 966 → ف↔غ NOT in ORTHO_PAIRS → **REJECT**
109
+
110
+ `ف` and `غ` are **adjacent on the Arabic keyboard** — this is a classic keyboard typo pattern.
111
+
112
+ Affected letter pairs NOT in ORTHO_PAIRS:
113
+ - ف↔غ (fa/ghayn — adjacent)
114
+ - ق↔ف (qaf/fa — adjacent)
115
+ - ع↔غ (ain/ghayn — related)
116
+ - ص↔ض (sad/dad — related)
117
+ - ث↔ت (tha/ta — related)
118
+ - ذ↔د (dhal/dal — related)
119
+ - ز↔ر (zay/ra — adjacent)
120
+ - ط↔ظ (ta/dha — related)
121
+ - س↔ش (sin/shin — related)
122
+ - ح↔خ (ha/kha — related)
123
 
124
  ---
125
 
 
149
 
150
  Zero conflicts in 270 samples. No architectural change needed.
151
 
152
+ ### Priority 6: Add keyboard-adjacent pairs to spelling ORTHO_PAIRS
153
+
154
+ The spelling filter blocks genuine keyboard typos (`بالرفم`→`بالرغم`) because ف↔غ is not in ORTHO_PAIRS. Two approaches:
155
+
156
+ **Option A**: Add keyboard-adjacent Arabic letter pairs to ORTHO_PAIRS (simple, ~10 pairs)
157
+ - Risk: may allow some unwanted corrections between similar-sounding letters
158
+ - Benefit: fixes the most common real-world typo pattern
159
+
160
+ **Option B**: Create a separate `KEYBOARD_TYPO_PAIRS` set with weaker confidence (0.5)
161
+ - Risk: more complex logic
162
+ - Benefit: allows keyboard typos but with dampened confidence for user review
163
+
164
  ### Not Recommended
165
 
166
  - Adding NER — entity FP (3 cases) are minor compared to grammar issues
167
  - Replacing grammar model — the model IS producing correct corrections for most patterns
168
  - Redesigning OffsetMapper — edge case documented but not causing failures
169
+