Skip to main content

Generate Anki flashcard decks for JLPT Kanji with customizable templates

Project description

Anki Kanji Deck Generator

A Python package designed to generate Anki flashcard decks for JLPT and Kyōiku Kanji with highly customizable templates. This tool provides a clean API using the KanjiDeck class to fetch comprehensive data from the Kanjilive API and build structured Anki decks (.apkg files) using the genanki library.

🌟 Features

  • Flexible API: Easy-to-use KanjiDeck().generate_deck() method allows simple deck creation via code.
  • Dual Filtering Support: Generate decks based on:
    • JLPT Levels: N5, N4, N3, N2, N1.
    • Kyōiku Grades: Grade 1 through Grade 6.
  • Customizable Templates: Supports using custom HTML and CSS templates for unique card styling.
  • Simple Installation: Available directly via PyPI.

🛠️ Prerequisites

  • Python 3.11 or newer.

🚀 Installation

Install the package directly from PyPI using pip:

pip install anki-kanji-deck-generator

💡 Usage

The primary way to use this tool is by importing the KanjiDeck class and calling the generate_deck method with the desired parameters within a Python script.

Example: Generating All Decks

Create a Python file (e.g., generate_all.py) and include the following code to generate all JLPT and Kyōiku Grade decks:

from kanjideck_generator import KanjiDeck
# Initialize the deck generator
generator = KanjiDeck()

# --- Generate JLPT Decks (N5 to N1) ---
print("Generating JLPT decks...")
generator.generate_deck(level_type='jlpt', level='n5', output_filename='jlpt_n5_deck.apkg')
generator.generate_deck(level_type='jlpt', level='n4', output_filename='jlpt_n4_deck.apkg')
generator.generate_deck(level_type='jlpt', level='n3', output_filename='jlpt_n3_deck.apkg')
generator.generate_deck(level_type='jlpt', level='n2', output_filename='jlpt_n2_deck.apkg')
generator.generate_deck(level_type='jlpt', level='n1', output_filename='jlpt_n1_deck.apkg')

# --- Generate Kyōiku Grade Decks (Grade 1 to 6) ---
print("Generating Grade decks...")
generator.generate_deck(level_type='grade', level=1, output_filename='grade_1_deck.apkg')
generator.generate_deck(level_type='grade', level=2, output_filename='grade_2_deck.apkg')
generator.generate_deck(level_type='grade', level=3, output_filename='grade_3_deck.apkg')
generator.generate_deck(level_type='grade', level=4, output_filename='grade_4_deck.apkg')
generator.generate_deck(level_type='grade', level=5, output_filename='grade_5_deck.apkg')
generator.generate_deck(level_type='grade', level=6, output_filename='grade_6_deck.apkg')


### Running the Example

Execute the script using your Python interpreter:

```bash
python generate_all.py

Importing into Anki

Find the generated .apkg files in the directory where you ran the script, open your Anki application, and import them via FileImport.


📸 Screenshots

Here are examples of the generated Anki flashcards as they appear in the AnkiDroid mobile app:

Front of the Card

The front of the card typically displays the Kanji character, prompting the user to recall its meaning and readings.

Back of the Card

The back of the card reveals all about the Kanji including readings, meanings, and mnemonic hint.

📦 Key Dependencies

This package automatically installs the following core dependencies:

  • genanki: For programmatic generation of Anki decks.
  • requests: For fetching data from the Kanjilive API.
  • pandas: For data manipulation and structuring.
  • pydantic: For validating the fetched Kanji data schema.

🤝 Credits

This project relies on the following excellent tools and services:

  • Kanjilive API: The source for comprehensive Kanji data.
  • genanki: The library used for deck construction.

📄 License

This project is licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

anki_kanji_deck_generator-0.1.4.tar.gz (46.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

anki_kanji_deck_generator-0.1.4-py3-none-any.whl (46.5 kB view details)

Uploaded Python 3

File details

Details for the file anki_kanji_deck_generator-0.1.4.tar.gz.

File metadata

File hashes

Hashes for anki_kanji_deck_generator-0.1.4.tar.gz
Algorithm Hash digest
SHA256 4bcab4adf06fc3a9d46f6a6007724d8aea88e551a8545853da78da60e2823bd9
MD5 51140d569b73e7d730306d57d43ecb99
BLAKE2b-256 4a0638b153707077d3cf470812b3ce00715d9fb03c4219273def033c7729225c

See more details on using hashes here.

File details

Details for the file anki_kanji_deck_generator-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for anki_kanji_deck_generator-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 d7b887b820da5d7e9f3b1ae419b95243b91b3aa9c9aff00a981a8668515a43ca
MD5 0f7b81b5b328476498a85c0e2917848b
BLAKE2b-256 d5765e5123d734ba732bd0075b4305aad06b3bb582d5dfc43dccd7abbc41640b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page