diff --git a/src/spellcheck/spell-checker.ts b/src/spellcheck/spell-checker.ts index 347d412..6efb954 100644 --- a/src/spellcheck/spell-checker.ts +++ b/src/spellcheck/spell-checker.ts @@ -284,6 +284,13 @@ export class SpellChecker { suggestions.slice(1), ); + // Boost confidence when aggressive normalization was used and found a match. + // The fact that heavy garbling (repeated chars, embedded digits) normalized + // to something within edit distance of a real word is strong evidence of a typo. + if (confidenceBaseWord !== normalizedWord) { + confidence = Math.min(confidence * 1.2, 1.0); + } + // Adjust confidence for technical context if detected. // Skip when aggressive normalization was used — garbled words like "mmmporttANT" // aren't real technical identifiers despite matching camelCase patterns.