Skip to content

Conversation

@koinsaari
Copy link

@koinsaari koinsaari commented Dec 14, 2025

  • Adds dictionary-based word suggestions while typing
  • Auto-corrects misspelled words when pressing space
  • Adds settings toggles for suggestions and auto-correct
  • Disables suggestions and correct for password fields
  • Uses wordfreq dictionary, only English in this commit

Type of change(s)

  • Bug fix
  • Feature / enhancement
  • Infrastructure / tooling (CI, build, deps, tests)
  • Documentation

What changed and why

  • Added dictionary-based word suggestions while typing
  • Added auto-correction for misspelled words when pressing space
  • Added settings toggles for both of those
  • Added 25K word English dictionary from wordfreq (https://github.com/rspeer/wordfreq) which lists words by usage frequency, so common words rank higher in suggestions
  • Loads dictionary on background thread
  • Uses cache and debouncing for performance

Tests performed

  • Typed misspelled words and verified suggestions appear
  • Tapped suggestions to apply them
  • Tested auto-correct on space with misspelled words
  • Verified no suggestions appear in password fields
  • Tested with suggestions/auto-correct disabled in settings
  • Verified keyboard doesn't freeze on first open when the async dictionary is loading

Preview

demo1.mp4
demo2.mp4

Closes the following issue(s)

Checklist

  • I read the contribution guidelines.
  • I manually tested my changes on device/emulator (if applicable).
  • I updated the "Unreleased" section in CHANGELOG.md (if applicable).
  • I have self-reviewed my pull request (no typos, formatting errors, etc.).
  • All checks are passing.

Discussion

The embedded dictionary in this solution adds about 920KB in assets and this is only for English. For now this was the simplest solution I could think that works offline and works at least decently. If using the same approach for other languages, would need to download dictionaries for each and this would bloat the APK size even more.

Other better approach could be adding the option for users to select dictionaries to download. This would keep the base APK small and let users download only what they need for their language. What do you think?

Also, the correction algorithm in this version is the Levenshtein algorithm so it treats all character substitutions equally, which isn't always accurate. For example, typing "hrllo" instead of "hello" is likely a fat-finger error since r and e are right next to each other on at least QWERTY keyboards, but the algorithm doesn't know this. A future improvement could be to add keyboard proximity weighting so adjacent-key typos score higher than distant-key errors which would make suggestions more relevant.

- Adds dictionary-based word suggestions while typing
- Auto-corrects misspelled words when pressing space
- Adds settings toggles for suggestions and auto-correct
- Disables suggestions and correct for password fields
- Uses wordfreq dictionary, only English in this commit
@koinsaari koinsaari force-pushed the feature/58-autocorrect branch from 5dd3480 to 5ce8d01 Compare December 14, 2025 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Autocorrect / suggestion strip

1 participant