Skip to content

About

Generate sets of flashcards (with audio!) from English to Spanish and French for whatever topic you like. Used for vocab learning

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

Anki Deck Builder (CLI)

Generate two Anki .apkg decks from a subject area using OpenAI.

The app will:

  • Generate a user-selected number of English words/phrases for a subject (default: 20)
  • Deduplicate and remove near-duplicates
  • Let you select terms in a CLI UI (all selected by default)
  • Translate selected terms into both French and Spanish
  • Generate spoken audio for translated terms (French and Spanish)
  • Export two ready-to-import .apkg files:
  • English -> French
  • English -> Spanish

Requirements

  • Python 3.9+
  • OpenAI API key

Setup

python3 -m venv .venv
source .venv/bin/activate
pip install .
cp .env.example .env
# Edit .env and set OPENAI_API_KEY

Optional audio config in .env:

OPENAI_ENABLE_AUDIO=true
OPENAI_TTS_MODEL=gpt-4o-mini-tts
OPENAI_TTS_VOICE=alloy
OPENAI_TTS_VOICE_FRENCH=alloy
OPENAI_TTS_VOICE_SPANISH=alloy
OPENAI_TTS_INSTRUCTIONS_FRENCH=Speak in a native Parisian French accent.
OPENAI_TTS_INSTRUCTIONS_SPANISH=Speak in a native Castilian Spanish accent.

Run

source .venv/bin/activate
anki-deck-builder

Or:

python -m anki_deck_builder

Most-used language mode (mutually exclusive flags):

anki-deck-builder --gen-1000-fr
anki-deck-builder --gen-1000-es

In this mode, the app loads terms from local frequency files:

  • data/fr_50k.txt
  • data/es_50k.txt

The app filters out entries containing punctuation (for example j'), takes the top 1000 clean unique terms, and skips the selector (all terms are used). Translation is source-language aware in this mode and only the relevant deck is generated:

  • --gen-1000-fr: French source terms -> English/French cards, French deck only.
  • --gen-1000-es: Spanish source terms -> English/Spanish cards, Spanish deck only.

Selector Controls

  • Tab / Shift+Tab / Up / Down: move selection
  • PgUp / PgDn: jump-scroll the list
  • Space: toggle selected/deselected
  • r: refresh terms (max 3 times)
  • Enter: confirm selection and continue

Output

Deck files are written to:

  • output/<subject>_en_to_french_<timestamp>.apkg
  • output/<subject>_en_to_spanish_<timestamp>.apkg
  • Audio files are cached under output/audio/cache/ and reused across runs when text matches.

Notes

  • Default model is gpt-4.1-mini (override with OPENAI_MODEL in .env).
  • Card front is English; each deck back is one language only.
  • Back of each card includes an audio player for the translated term.
  • Subject is included as a context field on the card back.
  • Accent/voice steering can be tuned with OPENAI_TTS_* language-specific env vars.
  • During audio generation, the CLI prints per-item progress like [12/40] French generated: term.

About

Generate sets of flashcards (with audio!) from English to Spanish and French for whatever topic you like. Used for vocab learning

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages