Generates an Anki deck given a JSON object that describes sentence cards used for language learning.
The goal for this project is to eventually have ChatGPT integration to generate an Anki deck of example sentences given a list of words you want to learn.
Sentence cards are effective for language learning because they help you learn vocabulary in the context of its actual usage, building intuition for grammar within a language.
Suppose you want to learn the following words in Croatian:
- Četkica za zube - Toothbrush
- Pasta za zube - Toothpaste
- Šampon - Shampoo
ChatGPT generates the following example sentences:
{
"flashcards": [
{"Front": "Koristim četkicu za zube svaki dan.", "Back": "Četkica za zube - Toothbrush"},
{"Front": "Stavio/la sam pastu za zube na četkicu.", "Back": "Pasta za zube - Toothpaste, staviti (to apply)"},
{"Front": "Kupujem novi šampon za kosu.", "Back": "Šampon - Shampoo"}
]
}
The program then outputs a .apkg file for the Anki Deck in the given directory.
-
Install Dependencies:
Before running the script, make sure to install the necessary dependencies. You can do this using the following command:
pip3 install genanki
-
Run Script
python3 card-generator.py --file example.json --deck_name example_deck
- Integrate with chatGPT to generate the list of example sentences given a list of words instead of pre-providing a JSON object.
- Integrate with Google Translate API to auto-generate a TTS audio-fiel for the given Anki Card.
I'd be surprised if anyone else will ever want to use this or contribute to this, but feel free to make a pull request if you want!
This project is licensed under the MIT License.