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.3.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.3-py3-none-any.whl (46.5 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for anki_kanji_deck_generator-0.1.3.tar.gz
Algorithm Hash digest
SHA256 a60992f331e417773bc6efdb32327c233de8b87e258fbe5e8c94e224b20a936a
MD5 4174523b8186ec4723dd72e5a23ae5f7
BLAKE2b-256 0ed0002d94a3df30bc3b7ad74ee6ddeced26b90b09a15d254c1382b23e7bd73d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for anki_kanji_deck_generator-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 0cf4ea1b06a28ceb14c9380c6a1dfb10113aebed1b62cd2e94c46ce1330cc65f
MD5 7f1522a80150ad889d4ab2a301558ef2
BLAKE2b-256 cf90bb64f2102e3c27e0e73ccd48cb189559eac7aaf5649ced06f1dd9b2d9423

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