Flashcard Application
A modular, efficient Anki-style flashcard application built with Python and Tkinter.
This follows a modular design with clear separation of concerns:
Module Structure
AnkiCards/ ├── main.py # Entry point ├── models.py # Data models (Card) ├── loader.py # File loading logic ├── session.py # Session management ├── utils.py # Utility functions (normalization) └── ui/ ├── init.py ├── app.py # Main application window └── components.py # Reusable UI components
Principles Used:
- Separation - Each module has a single, well-defined responsibility
- Lazy Loading - Pandas is only loaded when needed (not at import time)
- Caching - Translation tables and other expensive operations are cached
- Reuseability - UI components are modular and reusable
- Data - Cards are normalized at creation time
- Efficiency - Uses sets for O(1) lookups, optimized list operations
Key Optimizations
- Pandas DataFrame is only created when needed
- Punctuation translation table is cached globally
- Uses set operations for group filtering
- Handles both JSON arrays and JSONL formats efficiently
- Reduces redundant code and improves maintainability
How to use
python main.py [deck.json]Or use the original entry point (backwards compatible):
python anki.py [deck.json]Current - Features
- Load cards from JSON or JSONL files
- Group-based filtering
- Practice modes (type current side, type translation)
- Keyboard shortcuts (Space to flip, Arrow keys to navigate)
- Progress tracking
- Smart text normalization for answer checking