A user-editable word list that feeds the same SymSpell index the shipped frequency dictionaries use.
Words that aren't in the shipped dictionary (names, product names, domain jargon) currently degrade suggestions in four separate ways, and reading through it, all four go through SymSpell.words / SymSpell.deletes:
- Autocorrect rewrites the word into a dictionary neighbour (
Engine.swift:848 -> SpellChecker.correct)
- The typo gate skips generation entirely after an unknown completed word (
Engine.swift:1253)
reconcileMidWord rejects a mid-word completion when partial+fragment isn't a known prefix (Engine.swift:984)
- No instant dictionary ghost for the term (
SymSpell.topCompletion, SymSpell.swift:52)
Number 3 already has a workaround at Engine.swift:973-982 that rescues the completion if the word happens to be visible on screen, so I assume this is a known rough edge.
How does Cotypist or another tool handle it? (optional)
macOS has "Learn Spelling" via NSSpellChecker, but that writes to the system-wide dictionary and can't do frequency-ranked prefix completion, so it wouldn't cover number 4.
Anything else
Rough sketch of the approach:
SymSpell.add(words:frequency:) inserting into words and running editsPrefix into deletes
- Called from
SpellChecker.ensureLoaded rather than once at startup, so custom words survive the maxLoaded = 2 LRU eviction and index rebuild
- Word list editor in the Personalization pane
- The assigned frequency has to land above the
best.freq >= 1000 gate in topCompletion, or custom words never produce an instant ghost
Happy to open a PR if you're interested. Two things I'd want your call on first: whether the word list should be per-language or global, and whether you'd want it to also suppress autocorrect (number 1) or only affect completion.
A user-editable word list that feeds the same SymSpell index the shipped frequency dictionaries use.
Words that aren't in the shipped dictionary (names, product names, domain jargon) currently degrade suggestions in four separate ways, and reading through it, all four go through
SymSpell.words/SymSpell.deletes:Engine.swift:848->SpellChecker.correct)Engine.swift:1253)reconcileMidWordrejects a mid-word completion whenpartial+fragmentisn't a known prefix (Engine.swift:984)SymSpell.topCompletion,SymSpell.swift:52)Number 3 already has a workaround at
Engine.swift:973-982that rescues the completion if the word happens to be visible on screen, so I assume this is a known rough edge.How does Cotypist or another tool handle it? (optional)
macOS has "Learn Spelling" via
NSSpellChecker, but that writes to the system-wide dictionary and can't do frequency-ranked prefix completion, so it wouldn't cover number 4.Anything else
Rough sketch of the approach:
SymSpell.add(words:frequency:)inserting intowordsand runningeditsPrefixintodeletesSpellChecker.ensureLoadedrather than once at startup, so custom words survive themaxLoaded = 2LRU eviction and index rebuildbest.freq >= 1000gate intopCompletion, or custom words never produce an instant ghostHappy to open a PR if you're interested. Two things I'd want your call on first: whether the word list should be per-language or global, and whether you'd want it to also suppress autocorrect (number 1) or only affect completion.