feat(dictionary): flag unknown words with Add/Block + blocklist screen (#40)#59
Merged
Conversation
#40) C4-ui: when a suggestion is only learned/typed (not in a real dictionary), underline it in the strip and offer Add-to-dictionary / Block on long-press. Adds a per-locale Blocklist settings screen. Backend (DictionaryFacilitator): - addToUserDictionary(word): promote to personal dict + un-blacklist (only once the user dict is resolvable, so we never un-block without adding). - blockWord(word): delegates to removeWord (which already permanently blacklists in every group, incl. history-only words) - gives the UI a clear verb. UI: - SuggestionStripLayoutHelper: underline suggestions whose mSourceDict is USER_HISTORY/USER_TYPED, gated by new pref PREF_FLAG_UNKNOWN_WORDS (default on). - SuggestionStripView: long-press an uncurated word -> AlertDialog (Add/Block/Cancel); curated words keep the existing bin. - BlocklistScreen: per-locale view/remove of blocked words (filesDir/blacklists/*.txt). Test: removeFromBlacklist round-trip (the Add un-block path).
Owner
Author
|
On-device verified (S24+, standard debug build): unknown-word underline shows, long-press Add/Block dialog works, and the Blocklist settings screen lists/removes. ✅ |
This was referenced Jun 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements #40 (C4-ui) — the clarity layer on top of the #43 blocklist backend.
What it does
USER_HISTORY/USER_TYPED, i.e. not in a real dictionary) get a subtle underline in the strip. Gated by new prefPREF_FLAG_UNKNOWN_WORDS(default on; toggle in Settings → Dictionaries).Backend (
DictionaryFacilitator)addToUserDictionary(word)— promote to the personal dictionary and un-blacklist. Resolves the user dict first, so a word is never un-blocked without actually being added.blockWord(word)— delegates toremoveWord, which (post-fix(dictionary): stop deleted/junk words from resurrecting (incl. via swipe) #43) already permanently blacklists in every group including history-only words; this just gives the UI a clear verb.Why the source-dict heuristic for flagging
mSourceDict ∈ {USER_HISTORY, USER_TYPED}is cheap (no per-suggestion dict lookup in the view layer) and well-grounded:IMPROVEMENT_PLAN.mdalready usesmSourceDict != DICTIONARY_USER_TYPEDto mean “real dictionary word” — so a valid typed word carries a real-dict source and is not flagged; only typed-but-unknown and learned words are. (#39 C4-smart is the algorithmic follow-up.)Verification
:app:testOfflineRunTestsUnitTest: 220 tests, 13 failed — all 13 are the exact dev baseline (4 Windows-only ParserTest + the 9 that PR ci: make unit-test gate green and blocking (#12) #57 quarantines, not yet merged to dev). NewDictionaryGroupTest.removeFromBlacklist_unblocksWordpasses. Zero new failures.Known limitations (deliberate, for follow-up)
!isInNonHistoryDictionary) exists but needs the facilitator plumbed into the view; deferred to C4-smart: Graduated trust for non-dictionary learned words #39.blockWordblocks across all loaded locales (matches the existing bin behavior).Implemented coordinator (backend + pref + strings + test) with two parallel subagents (strip UI; settings screen) on disjoint files. Base
dev; leaving for review + merge.