diff --git a/docs/plans/2026-02-23-word-dictionary-mode-design.md b/docs/plans/2026-02-23-word-dictionary-mode-design.md new file mode 100644 index 0000000..a838a9d --- /dev/null +++ b/docs/plans/2026-02-23-word-dictionary-mode-design.md @@ -0,0 +1,163 @@ +# Word Dictionary Solve Mode — Design + +## Overview + +Add a new "word" solve mode that searches English nouns (single-word) and +adjective+noun / noun+noun phrases (two-word) against redaction pixel widths. +Both search phases run simultaneously when the user selects word mode. + +## UI Changes + +### Mode Dropdown + +Add `"word"` option to the existing solve-mode ` Ensure plural`. + +### `popover.js` + +- Show/hide `#plural-label` based on `solveMode.value === "word"`. +- Hide word-filter dropdown when mode is `"word"`. + +### `solver.js` + +- Include `ensure_plural` in the `POST /api/solve` body when mode is `"word"`. + +## Performance Estimate + +- Phase 1 (single word): ~40K width measurements ≈ <1 second. +- Phase 2 (two words): ~60K word1 × binary search over ~40K sorted word2 + ≈ 2–5 seconds depending on font/tolerance. +- Total: results start streaming within ~1 second; full search completes in + under 10 seconds. + +## Word List Generation + +One-time script (`scripts/generate_word_lists.py` or similar): + +1. Use NLTK to extract nouns and adjectives from WordNet. +2. Download djstrong Wiktionary noun.csv for irregular plural mappings. +3. Generate `nouns_plural.txt` using Wiktionary + rules. +4. Write `nouns.txt`, `nouns_plural.txt`, `adjectives.txt` to `unredact/data/`. +5. Commit generated files to the repo (they're small enough).