How ducngg/v7 works
Project type and purpose
• This is a desktop-style Vietnamese input method application (“v7”) written in Python 3.12.
• It combines a rule-based input-method engine with an optional AI-powered predictor (a nanoGPT-derived model) to turn partial keystrokes into full Vietnamese text.
File structure
• Top-level:
• main.py / main_app.py – entry points
• requirements.txt / requirements_ai.txt – deps for core vs AI modes
• checkpoints/ – persisted JSON dictionaries & model checkpoints
• assets/ – static files (demo GIF, images)
• ai/ – code for model config, tokenizer, model definition, inference utilities
• imethod/ – core input-method logic (v7 rules + AI hook)
• app/ – application orchestration & UI:
• app.py – glues listener, processor, UI
• listener.py – captures keystrokes
• gui.py – renders suggestions, popup window
• args.py, properties.py, combinations.py, utils.py – CLI flags, settings, helper routines
• models/ – domain models (dictionary structures, app config, imethod abstractions)
• utils/ – shared helpers (preprocessing, logging, unicode/dictionary utilities)
• sandbox/ – experimental scripts
README for additional insights
• Two modes:
• Classical (“VNI‐compatible” 8-tone mapping) via imethod/v7.py
• AI Mode via imethod/v7ai.py + ai/model.py + tokenizer, using a pretrained GPT checkpoint
• Data flow: keystroke → rule-based lookup or AI model → ranked suggestions → user picks