waf / anki-thai

Build an Thai Vocab Anki deck from a JSON file
MIT License
10 stars 1 forks source link

Source map files #3

Closed newhen closed 5 years ago

newhen commented 6 years ago

Where do I get a source map file like you have

waf commented 6 years ago

Hi @newhen, sorry for the delay, I missed this notification.

The source map file is up to you to design, if you need it. Because the input card data is an array of json objects that looks something like this:

[
    {
        "rank":"1",
        "source":"AUA Reader AUA Chapter 01",
        "thai": "ดี",
        "english":"To be good."
   },
   {
        "rank":"1",
        "source":"AUA Reader AUA Chapter 02",
        "thai": "หนึ่ง",
        "english":"One, a."
   },
]

If you import this file, it would not have any categories 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"
    }
}

This would map the "source" field to an Anki category. The end result is a structured deck like the following: