3.2 KiB
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
- Architecture & Storage: Local SQLite database.
- Fuzzy Search: Approximate string matching with similarity percentage threshold for typo tolerance.
- Data Source: Rich English-English dictionary dataset (definitions, nuances, part of speech, usage examples, collocations, antonyms/synonyms).
- Modularity: An isolated, standalone utility (
lex) within thegravitinyworkspace. - Language & Stack: Python 3 (
richfor terminal UI, standardsqlite3,rapidfuzz/difflibfor similarity calculation). - Primary Mode (Quick Mode): Called directly via
lex <word>. Returns a clean, concise summary card. If not found, outputs a standardized catalog message. - 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. - Code Standards: Professional English in all code, comments, catalogs, and documentation. No emojis in terminal UI or codebase.
Pending Topics & Decisions
-
4. Database Population / Seeding: Implemented via Princeton WordNet 3.0 SQLite seeder and Kaikki Turkish-to-English dataset (206k English + 45.8k Turkish entries).
-
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). -
12. Sub-millisecond Bilingual Auto-Routing: Automatically detects Turkish and English queries without manual mode switching; routes to appropriate card renderer.
-
3. Quick Mode Card Layout & Styling: Implemented via
lex/src/renderer.pyandrich.Panel. All UI labels, templates, and statuses centralized inlex/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 <word> --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.