This repository builds a thai.apkg file (for importing into Anki/AnkiDroid) from the JSON file resources/cards.sealang.json
.
It's built around thai/english language flashcards, but it shouldn't be too hard to repurpose it for other JSON files.
If you just want the Thai flashcards generated by this library, download dist/thai.apkg
.
If you want to generate your own Anki flash card deck (.apkg), clone this repo and modify the python script as required.
Modify the json-to-anki.py script. The script reads a json file that contains an array of the objects:
{
"rank":"1",
"source":"AUA Reader AUA Chapter 01",
"thai": "ดี",
"english":"good"
}
If you import this file, it would not have any nested decks in the resulting Anki deck (because it's a flat array of cards). If you want categories (in this case, a category for each chapter), you would design a source map like this:
{
"AUA Reader AUA Chapter 01": {
"source": "AUA Lessons::Chapter 01"
},
"AUA Reader AUA Chapter 02": {
"source": "AUA Lessons::Chapter 02"
}
}
Converts a json file to an APKG file, with support for nested decks.
# generate cards from a source json file
$ ./json-to-anki.py
A helper script for splitting large JSON files into smaller JSON files.
# list all sources
$ ./split-json.py list
# split source
$ ./split-json.py split $source $outfile
# example
$ ./split-json.py split SEAlang SEAlang.json
The SEALang deck generated from the cards.sealang.json file contains the following categories ("nested decks"):