feat(spellcheck): Update spell-checker algorithm to support custom dictionaries and improve language accuracy

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
Lilith 2026-02-26 22:43:01 -08:00
parent 9c51c0e70f
commit bde9b747b3

View file

@ -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.