Files
Code/python/persian-tutor
dl92 3a8705ece8 Fix bugs, N+1 queries, and wire settings in persian-tutor
- Replace inline __import__("datetime").timedelta hack with proper import
- Remove unused import random in anki_export.py
- Add error handling for Claude CLI subprocess failures in ai.py
- Fix hardcoded absolute path in stt.py with relative Path resolution
- Fix N+1 DB queries in vocab.get_flashcard_batch and dashboard.get_category_breakdown
  by adding db.get_all_word_progress() batch query
- Wire Ollama model and Whisper size settings to actually update config
  via ai.set_ollama_model() and stt.set_whisper_size()

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 15:40:24 +00:00
..

Persian Language Tutor

A Gradio-based Persian (Farsi) language learning app for English speakers, built around GCSE Persian vocabulary (Pearson specification).

Features

  • Vocabulary Study — Search, browse, and study 918 GCSE Persian words across 39 categories
  • Flashcards with FSRS — Spaced repetition scheduling (same algorithm as Anki)
  • Idioms & Expressions — 25 Persian social conventions with cultural context
  • AI Tutor — Conversational Persian lessons by GCSE theme (via Ollama)
  • Essay Marking — Write Persian essays, get AI feedback and grading (via Claude)
  • Dashboard — Track progress, streaks, and mastery
  • Anki Export — Generate .apkg decks for offline study
  • Voice Input — Speak Persian via microphone (Whisper STT) in the Tutor tab

Prerequisites

  • whisper-ollama conda environment with Python 3.10+
  • Ollama running locally with qwen2.5:7b (or another model)
  • Claude CLI installed (for essay marking / smart mode)

Setup

/home/ys/miniforge3/envs/whisper-ollama/bin/pip install gradio genanki fsrs

Running the app

cd /home/ys/family-repo/Code/python/persian-tutor
/home/ys/miniforge3/envs/whisper-ollama/bin/python app.py

Then open http://localhost:7860 in your browser.

Running tests

cd /home/ys/family-repo/Code/python/persian-tutor
/home/ys/miniforge3/envs/whisper-ollama/bin/python -m pytest tests/ -v

41 tests covering db, vocab, ai, and anki_export modules.

Expanding vocabulary

The vocabulary can be expanded by editing data/vocabulary.json directly or by updating scripts/build_vocab.py and re-running it:

/home/ys/miniforge3/envs/whisper-ollama/bin/python scripts/build_vocab.py

TODO

  • Voice-based vocabulary testing — answer flashcard prompts by speaking Persian
  • Improved UI theme and layout polish