An AI-assisted command line companion for growing bilingual or monolingual vocabulary lists, producing tidy LaTeX, and exporting Anki decks. The current release focuses on a smooth first-run experience so you can get productive within minutes.
- Multi-language vocab builder -- swap languages with
--language(Englishen, Frenchfr, and Germande) and keep each glossary in its own LaTeX file. - Native-English vocabulary mode -- learn uncommon English words through concise definitions, contextual examples, plain-English recall cues, and usage coaching without irrelevant translation menus.
- Rich CLI UX -- colour panels, guided prompts, and smart duplicate detection make the terminal feel welcoming.
- Bidirectional translators -- jump between English->Target and Target->English flows with sentence-aware routing.
- Deterministic exports -- LaTeX remains brace-balanced; Anki decks use language-specific metadata with stable note IDs.
- Learning-first Anki order -- LaTeX stays alphabetized for reading, while Anki keeps persistent acquisition order; older untracked entries receive a stable non-alphabetical fallback order.
- Explicit Anki exports -- every
.apkgis built on request from the CLI, the Mac client (which downloads it), or the phone, with incremental, full-rebuild, selected-word, and reconcile modes; nothing is exported unattended.
- Python 3.11+
- Internet access for the selected AI provider (Google Gemini or Anthropic Claude)
The optional mobile surface turns VocabBuilder into a small installable web app without publishing it to the public internet. A Tailscale-connected VM owns the authoritative vocabulary files; iPhone capture, the Mac browser, and the full Mac terminal interface all work against that same data.
Install the optional server dependencies with pip install '.[mobile]', then
see docs/MOBILE.md for the multilingual one-source-of-truth
architecture, private deployment layout, phone installation, and local Rich launcher.
pip install vocab-builder
vocabbuilder --language fr
# or launch the monolingual English helper
vocabbuilder --language engit clone https://github.com/RazeBerry/FrenchVocab.git
cd FrenchVocab
pip install -e .
vocabbuilder --language frWhat happens next:
- Provider choice. The wizard lets you pick Google Gemini (recommended) or Anthropic Claude. Each option links to the provider's signup page.
- Key entry. Paste your API key; the input is hidden. The app validates the key format and performs a live connection test (5 s timeout) before accepting it.
- Storage decision. After a successful validation you choose where to store the key:
- System keyring (default). Saved securely via your OS keychain.
- Project
.envfile. Writes or updates.envin the repository root. - Session only. Sets an environment variable for the current process and reminds you that future runs will prompt again.
- Run the CLI. Once stored, the key is placed in
os.environfor immediate use and the vocabulary menu appears.
Tips:
- If the keyring backend is unavailable, the wizard automatically falls back and asks you to choose another storage option.
- Keys saved to
.envare auto-loaded on future runs -- even when you launch the CLI from a different directory.
Need to script or automate? Provide the key before starting the CLI and the wizard is skipped.
export GEMINI_API_KEY="AIza..."
# or
export ANTHROPIC_API_KEY="sk-ant-..."
vocabbuilder --language frpython - <<'PY'
import keyring
keyring.set_password("vocab_builder", "gemini_api_key", "AIza...")
PY
vocabbuilder --language frCreate or update .env in the repository root:
GEMINI_API_KEY=AIza...
# or
ANTHROPIC_API_KEY=sk-ant-...
The file is picked up automatically during startup.
Current resolution order on startup:
- Environment variable (
GEMINI_API_KEY/ANTHROPIC_API_KEY) - Project
.envfile (auto-loaded from the repo root) - System keyring entry (service
vocab_builder) - Interactive wizard
Invalid values are ignored with an on-screen warning, after which the next source is tried.
If you suspect the ESC key is laggy inside the Rich/Prompt-Toolkit prompts, enable the ad-hoc tracer:
export VOCABBUILDER_ESC_DEBUG=1
# optional: choose a custom path
# export VOCABBUILDER_ESC_DEBUG_LOG=/tmp/esc_latency.log
vocabbuilder --language frWhile the flag is set the CLI writes lifecycle events (prompt start, escape handler invocation, prompt exit) to ~/.vocabbuilder/esc_latency.log by default. Tail the file to inspect raw timings:
tail -f ~/.vocabbuilder/esc_latency.logTip: you can also pass --esc-debug (and --esc-debug-log=/tmp/esc_latency.log) when launching vocabbuilder to set these environment variables automatically for that session.
If you need to fine-tune how long the CLI waits for multi-byte escape sequences (arrow keys, etc.), set VOCABBUILDER_ESC_SEQUENCE_TIMEOUT (default 0.03 seconds). Smaller values make bare Esc faster but can interfere with arrow keys if set to zero.
Unset the environment variable to disable tracing once you have collected enough data.
vocabbuilder --language en-- collect uncommon English words, expressions, and usage examples.vocabbuilder --language de-- add new vocab entries (default menu option 1).- In bilingual French and German modes, translator flows capture multi-line input and preview results before saving.
- English usage practice includes both use-these-words exercises and recall from plain-English cues.
- Anki tools support incremental, full, and selected-word exports plus reconciliation and optional composition-mistake decks.
- View and search saved vocabulary from the Browse vocabulary menu.
Pass --verbose for timing details, or --provider claude to select Anthropic directly.
- Intelligent translator is now on by default: the Translation menu shows an "auto" option that detects direction and routes to the right LaTeX file while still letting you confirm the save. Set
VOCABBUILDER_AUTO_TRANSLATOR=0(orfalse) if you prefer to hide it and stick with the two explicit directions.
| Path | Purpose |
|---|---|
vocab_builder/ |
Main package (install target) |
vocab_builder/cli/main.py |
CLI entry point |
vocab_builder/core/ |
Shared workflows (setup wizard, translators, exporting) |
vocab_builder/cli/ |
Menu helpers and bootstrap logic |
vocab_builder/languages/ |
Per-language configs, prompts, and LaTeX templates |
tests/ |
Pytest suite covering language configs, exporters, and onboarding flows |
FrenchVocab.py |
Deprecated shim (use vocabbuilder instead) |
pip install -e .
pytestThe test suite uses stubs for external services; no real API calls are made.
- "No API key found" -- run
vocabbuilder --language frand walk through the wizard, or export the key viaexport GEMINI_API_KEY=.... - Keyring errors -- your OS keychain may be locked or unsupported; choose the
.envor session option when prompted. - Where is the
.envstored? -- we try the project directory first; if it's read-only we fall back to~/.vocabbuilder/.env. Override withVOCABBUILDER_CONFIG_DIR=/path/to/dirwhen needed. - Environment variable overrides -- if
GEMINI_API_KEY/ANTHROPIC_API_KEYis set in your shell, that value is used for the session and any saved keyring/.env entries are ignored. - Timeout during validation -- indicates provider connectivity issues. Verify the key is active and try again.
- Migrating from FrenchVocab -- old env vars (
FRENCHVOCAB_*,FRENCH_VOCAB_*), config dir (~/.frenchvocab/), and keyring entries (french_vocab_builder) still work but emit deprecation warnings. Update to the newVOCABBUILDER_*names at your convenience.
Machine-crafted vocabulary, human-readable output. Enjoy building your language decks!