Skip to content

featurequest/practice-japanese

Repository files navigation

Japanese Kana Practice

License: MIT Data: CC BY-SA 3.0

Generate printable flash cards, handwriting practice sheets, reference charts, and stroke order guides for all hiragana and katakana characters.

Produces five types of PDF:

  • Flash cards — 208 double-sided cards (104 hiragana + 104 katakana) arranged in a 3×3 grid on A4 pages, designed for duplex printing and cutting.
  • Practice sheets — Landscape A4 pages with 2cm grid boxes. Each character gets 3 rows: the first box shows the KanjiVG stroke-order character, the rest are empty for handwriting practice. Boxes include dashed cross guides for centering.
  • Reference charts — Landscape A4 pages with the standard gojūon table layout: basic characters, dakuten/handakuten, and yōon combinations with romaji labels.
  • Stroke order — Portrait A4 pages with KanjiVG stroke diagrams and numbered indicators for each character, split into basic, dakuten, and combination sections for readability.
  • Vocabulary reference — Per-JLPT-level (N5–N1) vocabulary PDFs in English and Swedish, sourced from JMdict. Each level contains all words for that level with meanings, POS, register tags, and antonyms.

Quick Start

pip install -r requirements.txt
python generate.py --setup      # verify prerequisites
python generate.py --kana       # generate flash cards → output/kana_flashcards.pdf

Requires Python 3.10+ and ReportLab. The Klee One font is bundled.

Downloads

Download the latest pre-built PDFs:

Examples

Flash cards — front (character) and back (romaji + stroke order):

Practice sheet:

Reference chart:

Stroke order:

Vocabulary reference:

Coverage

Each script includes:

  • 46 basic gojūon (あ→ん / ア→ン)
  • 20 dakuten variants (が, ざ, だ, ば / ガ, ザ, ダ, バ)
  • 5 handakuten variants (ぱ行 / パ行)
  • 33 yōon combinations (きゃ, しゅ, ちょ, etc.)

Card Layout

Front Back
Large kana character Romaji reading
Type label (hiragana/katakana) Stroke order diagram

Cards are 55×82mm (roughly A7), printed 9 per A4 sheet with cut lines.

Usage

All commands go through python generate.py. Run without arguments to see help.

Kana

python generate.py --kana                              # Flash cards (208 cards)
python generate.py --kana --hiragana-only              # Hiragana only
python generate.py --kana --katakana-only              # Katakana only
python generate.py --kana -o my_cards.pdf              # Custom output path

python generate.py --kana --practice                   # Practice sheets
python generate.py --kana --practice --hiragana-only

python generate.py --kana --chart                      # Reference chart
python generate.py --kana --chart --hiragana-only

python generate.py --kana --stroke-order               # Stroke order guide
python generate.py --kana --stroke-order --hiragana-only

python generate.py --kana --card-width 63 --card-height 88   # Custom card size (mm)

Vocabulary

python generate.py --vocabulary --jlpt n5              # N5 English  → output/vocabulary_n5.pdf
python generate.py --vocabulary --jlpt n5 --lang sv    # N5 Swedish  → output/vocabulary_sv_n5.pdf
python generate.py --vocabulary --jlpt n3              # N3 English  → output/vocabulary_n3.pdf
python generate.py --anki --jlpt n5                    # N5 Anki deck  → output/anki_n5.apkg
python generate.py --anki                              # All levels     → output/anki_n5.apkg … anki_n1.apkg + anki_all.apkg

Maintenance

python generate.py --setup                             # Check prerequisites; auto-build vocabulary data if missing
python generate.py --build-vocabulary                  # Force rebuild data/vocabulary.json (~50MB download)

Developer

python generate.py --update-strokes     # Re-download KanjiVG and regenerate stroke data
python generate.py --generate-examples  # Regenerate example images in docs/ (requires poppler-utils)

Printing

  1. Print the PDF double-sided with long-edge flip
  2. Cut along the gray grid lines
  3. Each card's front (character) aligns with its back (romaji + strokes)

Adjust BACK_PAGE_OFFSET_Y in config.py if your printer's duplex alignment is off.

Configuration

All tunables are in config.py. Values use ReportLab's mm unit.

Variable Default Description
CARD_WIDTH 55mm Card width (also settable via --card-width)
CARD_HEIGHT 82mm Card height (also settable via --card-height)
BACK_PAGE_OFFSET_Y -2.0mm Vertical shift for back page content to compensate for duplex misalignment. Positive = up, negative = down
KANA_FONT_SIZE 34mm Large character size on card front
ROMAJI_FONT_SIZE 8mm Romaji text size on card back
LABEL_FONT_SIZE 3mm "hiragana"/"katakana" label size on card front
STROKE_LINE_WIDTH 0.8mm Stroke diagram line thickness
STROKE_DOT_RADIUS 1.0mm Stroke start-point dot size
STROKE_COLORS list of 6 RGB tuples Per-stroke colors cycling indigo→emerald→red→amber→violet→cyan
CUT_LINE_WIDTH 0.2mm Cut guide line thickness
CUT_LINE_COLOR (0.7, 0.7, 0.7) Cut guide line color (light gray)

Grid layout (COLS, ROWS, MARGIN_X, MARGIN_Y) is auto-computed from the card and page sizes so cards are always centered on A4.

Licenses and Attribution

Stroke Data — KanjiVG

Stroke order data derived from KanjiVG by Ulrich Apel, licensed under Creative Commons Attribution-ShareAlike 3.0.

Adaptations: SVG stroke paths extracted, dakuten/handakuten/yōon variants composed from base characters for flash card and practice sheet rendering.

Vocabulary Data

data/vocabulary.json is built from two sources:

JLPT word lists by Jonathan Waller (https://www.tanos.co.uk/jlpt/), used with permission. Lists cover N5–N1 vocabulary.

JMdict by the Electronic Dictionary Research and Development Group (https://www.edrdg.org/), licensed under Creative Commons Attribution-ShareAlike 3.0. Provides multilingual meanings, part of speech, register tags, and antonyms.

Fonts

Python Dependencies

Package License Use
ReportLab BSD PDF generation
pykakasi GPL-3.0-or-later Romaji generation (build-time only)
genanki MIT Anki deck export