# LEX - Offline CLI Dictionary & Context Assistant ## Project Purpose A lightweight, fast, offline CLI tool to look up English words, nuances, contexts, and example sentences backed by SQLite and fuzzy search. --- ## Architectural Decisions 1. **Architecture & Storage:** Local SQLite database. 2. **Fuzzy Search:** Approximate string matching with similarity percentage threshold for typo tolerance. 3. **Data Source:** Rich English-English dictionary dataset (definitions, nuances, part of speech, usage examples, collocations, antonyms/synonyms). 4. **Modularity:** An isolated, standalone utility (`lex`) within the `gravitiny` workspace. 5. **Language & Stack:** Python 3 (`rich` for terminal UI, standard `sqlite3`, `rapidfuzz`/`difflib` for similarity calculation). 6. **Primary Mode (Quick Mode):** Called directly via `lex `. Returns a clean, concise summary card. If not found, outputs a standardized catalog message. 7. **Centralized UI/String Catalog:** All UI labels, headers, formatted layouts, prompts, and error/status messages stored in a centralized JSON file (`strings.json`). No hardcoded UI strings in code. 8. **Code Standards:** Professional English in all code, comments, catalogs, and documentation. No emojis in terminal UI or codebase. --- ## Pending Topics & Decisions - [x] **4. Database Population / Seeding:** Implemented via Princeton WordNet 3.0 SQLite seeder and Kaikki Turkish-to-English dataset (206k English + 45.8k Turkish entries). - [x] **5. Fuzzy Search Engine:** 3-stage candidate pruning (SQLite index filter -> sequence matcher ratio >= 75%). Handles character substitutions, omissions, common spelling typos, and Turkish diacritic normalization (`ç/c`, `ş/s`, `ğ/g`, `ı/i`, `ö/o`, `ü/u`). - [x] **12. Sub-millisecond Bilingual Auto-Routing:** Automatically detects Turkish and English queries without manual mode switching; routes to appropriate card renderer. - [x] **3. Quick Mode Card Layout & Styling:** Implemented via `lex/src/renderer.py` and `rich.Panel`. All UI labels, templates, and statuses centralized in `lex/catalog/strings.json`. - [ ] **7. Standalone GUI Installer & Uninstaller:** Source code developed; binary installer generation deferred until feature milestones are completed. - [ ] **1. Advanced Modes & Detailed Views:** Extended views (e.g., `lex --full`, etymology, full senses). - [ ] **2. Interactivity & TUI:** Interactive terminal navigation (e.g., arrow key sense browsing, list saving, filtering). - [ ] **6. Advanced Fuzzy Enhancements:** Future phonetic (Metaphone) and keyboard distance / QWERTY layout proximity scoring. - [ ] **8. Quick Start Guide (B1):** Concise walkthrough to get users productive within seconds. - [ ] **9. Interactive Settings Feature (C1):** Interactive configuration tool (`lex config`) to customize defaults, color themes, and fuzzy thresholds. - [ ] **10. Documentation, License & Changelog (C3):** Standardized repository documentation, MIT license details, and version changelog. - [ ] **11. Final Command Reference (B2):** Comprehensive parameter and flag reference to be finalized at the project conclusion. ## Bug & Issue Tracking Tracked actively in [ISSUES.md](file:///c:/Users/al3ph/Desktop/gravitiny/lex/ISSUES.md).