Hanzi Deck Statistics
An Anki addon that tracks how many Hanzi (Chinese characters) you've seen in each deck, with detailed breakdowns by HSK level and frequency.
Screenshots
Deck Selection
Multi-select decks with per-deck field and subdeck options
HSK 2.0 (2012) Breakdown
Track progress through HSK 2.0 levels 1-6
HSK 3.0 (2021) Breakdown
Comprehensive HSK 3.0 coverage with bands 1-9
Frequency Analysis
Character frequency rankings based on Jun Da corpus
Character Details
Click any category to see reviewed, missing, and not-in-deck characters
Features
- Multi-Deck Selection: Select multiple decks simultaneously with checkboxes
- Per-Deck Configuration: Choose specific fields and subdecks for each deck independently
- Combined Statistics: All selections merge into a single comprehensive view
- Auto-Refresh: Statistics update instantly when selections change
- Two Metrics:
- Total Hanzi: All unique characters in the deck (including new cards)
- Reviewed Hanzi: Characters you've actually studied
- Category Breakdowns:
- HSK 2.0 (2012) - Levels 1-6
- HSK 3.0 (2021) - Bands 1-9
- Frequency rankings (Rank 1-500, 501-1000, 1001-1500, 1501-2000)
- Interactive Details: Click any category to see specific characters (reviewed, missing, not in deck)
- Persistent Settings: Your selections are remembered across sessions
- Modern Data Sources: Uses up-to-date HSK 3.0 and frequency data from comprehensive corpora
- Beautiful UI: Clean, compact interface with progress bars and responsive design
Installation
Method 1: Manual Installation (Development)
-
Clone or download this repository to: C:\Users\Jonathan\Documents\repos\hanzi-deck-stats
-
Find your Anki addons folder:
- Open Anki
- Go to Tools โ Add-ons
- Click View Files
- This opens your addons21 folder
-
Create a folder named hanzi_deck_stats in the addons21 folder
-
Copy all files from this repository into that folder:
addons21/hanzi_deck_stats/
โโโ __init__.py
โโโ stats_calculator.py
โโโ stats_dialog.py
โโโ hanzi_detector.py
โโโ character_data.py
โโโ config.json
โโโ config.md
โโโ manifest.json
โโโ datasets/
โโโ hsk30-chars.csv
โโโ mega_hanzi_compilation.csv
-
Restart Anki
Method 2: AnkiWeb (Future)
Once published to AnkiWeb, you can install via:
- Tools โ Add-ons โ Get Add-ons
- Enter the addon code
Usage
- Open Anki
- Go to Tools โ Hanzi Deck Stats
- Select one or more decks using checkboxes
- For each selected deck, expand options to:
- Choose which fields to analyze (e.g., Hanzi, Pinyin, English)
- Select which subdecks to include
- Statistics automatically update as you make selections
- Your choices are saved and restored next time
Understanding the Statistics
Total Hanzi: All unique Hanzi characters found in cards in the deck, including new unseen cards. This shows the total learning material available.
Reviewed Hanzi: Unique Hanzi from cards you've reviewed at least once (cards with review history). This shows what you've been exposed to.
Progress Bars: Visual representation of how many characters you've reviewed vs. total.
Category Breakdown: Shows how many characters you've seen from each HSK level or frequency band.
Interactive Categories: Click any category row to see a detailed modal showing:
- โ Reviewed Characters (green)
- โ Not Yet Reviewed (red)
- โ Not in Deck (orange, for HSK categories only)
Configuration
Access configuration via Tools โ Add-ons โ Hanzi Deck Statistics โ Config
Options
-
showCategories: Whether to show HSK/frequency breakdowns (true/false)
-
categoriesToShow: List of categories to display (see config.md for options)
-
selectedDecks: Automatically saved dictionary of your deck/field/subdeck selections (managed by the UI)
Note: Field and subdeck selections are now managed per-deck through the UI and automatically saved. The old global fieldToUseForStats and includeSubdecks options have been replaced by per-deck selections.
Data Sources
This addon uses modern, comprehensive Chinese language datasets:
- HSK 2021 (HSK 3.0): Official 3,000 characters from ivankra/hsk30
- HSK 2012: Legacy HSK levels from comprehensive compilation
- Frequency Data: 11,266 characters from alyssabedard/chinese-hsk-and-frequency-lists, based on Jun Da's Modern Chinese Character Frequency List (193 million character corpus)
Technical Details
Character Detection
- Uses Unicode-based detection for CJK Unified Ideographs (U+3400-U+9FFF)
- Includes CJK Compatibility Ideographs (U+F900-U+FAFF)
- Normalizes all characters to NFC form for consistency
Database Queries
The addon queries Anki's database to find:
- Total cards:
cards.queue >= 0 (active cards, excluding suspended/buried)
- Reviewed cards: Cards with entries in the
revlog table
Performance
- Efficient SQL queries with proper indexing
- Progress indicators for long operations
- Caches character categorization data for speed
Development
Project Structure
hanzi-deck-stats/
โโโ __init__.py # Main entry point, menu integration
โโโ stats_calculator.py # Core statistics calculation logic
โโโ stats_dialog.py # UI dialog window
โโโ hanzi_detector.py # Character detection utilities
โโโ character_data.py # CSV data loader and categorization
โโโ config.json # Default configuration
โโโ config.md # Configuration documentation
โโโ manifest.json # Addon metadata
โโโ datasets/ # Character data files
โ โโโ hsk30-chars.csv
โ โโโ mega_hanzi_compilation.csv
โโโ README.md
Requirements
- Anki 2.1.49 or later
- Python 3.9+ (included with Anki)
- PyQt5/PyQt6 (included with Anki)
Building from Source
- Clone the repository
- Ensure datasets are in the
datasets/ folder
- Copy to Anki addons folder (see Installation above)
License
MIT License - see LICENSE file for details
Credits
Support
For issues, questions, or feature requests, please file an issue on GitHub.
Changelog
Version 1.0.0 (2025-11-09)
- Initial release with multi-deck selection
- Multi-deck selection with checkboxes (no "All Decks" option)
- Per-deck field selection with actual field names from note types
- Per-deck subdeck selection with individual checkboxes
- Combined statistics across all selected decks and fields
- Auto-refresh on any checkbox change
- Persistent settings (selections saved across sessions)
- Interactive character detail modals
- HSK 2.0 (2012) support with levels 1-6
- HSK 3.0 (2021) support with bands 1-9
- Frequency rankings based on Jun Da corpus (ranks 1-500, 501-1000, 1001-1500, 1501-2000)
- Official HSK character lists with "Not in Deck" tracking
- Modern, compact UI with collapsible deck options
- Comprehensive character data from multiple sources
- Fixed: Character counts now accurate (simplified only, no traditional duplicates)