# Deck format, schema 1 This page is the only deck format document (owner, 2026-11-02: "Wiki is the main home for all docs. other docs are obsolete"). `docs/DECK-FORMAT.md` in the repo is a pointer to it. Agents read it in the repo as `wiki/Deck-Format.md`. See [ADR-0044](ADR-0044-Documentation-Lives-In-The-Wiki). **This file is the guide; `tools/validate_decks.py` is the test.** When the two disagree, what the validator does is what passes CI, and this guide is fixed to match it (owner, 2026-10-13, #506: "validator is the test. deck-format is the guide"). This file also holds everything the old B1 format spec said that a deck author or a tool needs: that plan is folded in here and deleted, and its history is in git and [ADR-0036](ADR-0036-B1-Deck-Format). A deck is a single UTF-8 YAML file, or a core and its layers (see [Core and layer files](#core-and-layer-files)). Filenames are `.yaml` and live under `decks//`; a layer lives one folder down, in `decks///`. Four kinds of deck exist: `vocab` (a list of cards), `grammar` (a pattern table that expands into cards), `rules` (a table of a rule's forms over the words of one kind, which expands into cards; see [Rules decks](#rules-decks)) and `reading` (passages with questions about them). Another kind of file, `facts`, holds a language's daily facts rather than anything drilled. All five share the same header, with the differences a core and a layer make. Beside them sit files that are not decks: the shared [themes](#themes), each language's [number rules](#number-rules), and each language's [path](#paths). Validate before committing: ```sh python3 tools/validate_decks.py decks/ ``` ### How the validator reports - **Three kinds of message.** An error fails the run. A warning is a hint a contributor should read and, where it is wrong, explain. An info line never changes the exit code or the `N/M decks valid` line: it reports coverage, such as how much of a core a layer teaches. Each is printed under its file, `error`, `warning` or `info`, with where in the file it is. - **Errors again at the end.** When a run fails, it ends with an `Errors:` section, after the `N/M decks valid` line, repeating every error: each cross-file error as `error: {message}` and each file's errors as `error: {file}: {where}: {message}`. CI's log is thousands of lines long and the cross-file errors print near the top, so the end of the log is where to read them. A passing run has no such section. - **Checks across files** (card ids, refs, the path, phrasebook sizes, rows, bases coverage) print an error as `error: {file}: {where}: {message}`, and attach a warning or an info line to the file it is about. They report only on the files given now, on the command line or under a given directory. To check them, the validator also reads the rest of the language's files from `decks//` and one folder below it, and from the folders of the given files, so a fixture tree in a temporary folder is read like the repository. A file read for context is never reported on. - **The app agrees.** The Dart parser (`lib/core/data/deck_parser.dart`) never rejects a file the validator accepts, and both read every accepted file the same way, plain scalars included ([YAML values](#yaml-values)). Every rejection by the parser is also a validator error; the validator may check more. ## Script in prose: always with its reading The owner: "Always keep the transliteration, even in descriptions or labels." A learner reads a card's notes, meanings, descriptions, labels and facts long before they can read the script. So wherever deck text other than the word itself quotes a word, a letter or a sign in a script other than Latin, its reading (in letters based on ISO 15919) follows it in parentheses: ```yaml notes: "లేదు (lēdu) is 'there is not', the opposite of ఉంది (undi)." # right notes: "లేదు is 'there is not', the opposite of ఉంది." # rejected ``` - A suffix keeps its hyphen, `-ने (-ne)`; a vowel sign reads as its vowel, `ा (ā)`; a digit as its number, `३ (3)`. - The reading may come first instead: `lēdu (లేదు)`. - **Not needed** in the fields that are the word itself (`target`, `reading`, `ipa`, `forms`, `letters`, `term`, `example`, a passage's `text`), for signs with no sound of their own (the virama and the nukta), or, in text written for speakers of another language (a fact's `hi` or `bn`), for words in that reader's own script. A word in a third script there still takes one, in Latin or in the reader's script. - **In a [core and its layers](#core-and-layer-files),** every string of a layer is read as written for the layer's native language, whatever its key, and every string of a core is the language learnt's. So a Bengali layer's own Bengali words need no reading, and a Telugu word in it does. A key never decides the language there: the slot keys `"lo"` and `"to"` are not Lao and Tongan. - **The new prose fields** are held to it as every other: a note's `text` and a layer's note texts, a base's `meaning`, example translations, a rules layer's `slot_name`, slot labels, `prompts`, and each rule's `name` and `explanation`, a grammar layer's `name`, `slot_name`, `prompt`, glosses and `notes`, a layer's `name` and `description`, and a path's passage descriptions and region names, each read as written for its key's language, as a facts file's texts are. The language facts beside them (`word`, `base`, `ref`, `words`, `region`, a passage's `id`, a core's slot keys) are the word itself and need none. - **Placeholders are checked before they are filled.** A layer that quotes its core's words as `{1}`, `{2}` (see [Notes](#notes)) holds no script at that point, so it needs no reading there: the reading comes with the word from the core. `tools/transcribe.py` gives the reading, and `tools/validate_decks.py` rejects a word without one. --- ## Header Common to every kind. | Field | Required | Notes | |---|---|---| | `schema` | yes | Must be `1`. | | `id` | yes | Unique, `[a-z0-9-]+`, must equal the filename stem. A vocab or grammar deck's id starts with the language learned and then the language it is taught from: `hi-en-market` is Hindi from English. A facts file is about one language: `hi-facts`. A core's id is the language and a name, `te-home`; its layer's is the language, the native language and the same name, `te-en-home`, which is also the merged deck's id ([Core and layer files](#core-and-layer-files)). | | `name` | yes, except on a core | Human-readable title. A core has none: each layer gives it, in its own language. | | `kind` | no | `vocab` (default), `grammar`, `rules` for a [rules deck](#rules-decks) (a core and layers only), `reading` for [passages](#reading-decks), `layer` for a [layer](#a-layer), or `facts` for a [facts file](#facts-files). The files beside the decks have their own: `themes`, `numbers`, `path`, `romanisation`, `sounds` and `script`. | | `part` | on a core | `"core"`, and only on a core ([A core](#a-core)). Left out everywhere else. | | `core` | on a layer | The id of the core the layer translates, `"te-home"`. | | `language` | yes, except on a layer | The language being learned. See below. A layer takes its core's. | | `native` | yes, except on a facts file or a core | The language explanations are written in. A core has none: each layer names its own. | | `license` | yes | SPDX identifier: `"CC-BY-SA-4.0"` in this repository ([Licensing deck content](#licensing-deck-content)). | | `authors` | no | List of `{name, url?}`. | | `source` | no | Where the content comes from: a URL, or for a book its title, author, year and licence, as in `"Sahaj Path, part 1, by Rabindranath Tagore (1930), in the public domain"`. The app shows it on the deck's page, and Settings lists it under Sources. | | `description` | no | One or two sentences. | | `tags` | no | Deck-level tags, e.g. `[beginner, core]`. The tag `unreviewed` marks a deck no native speaker has checked: the app says so on the deck's screen. `reviewed` marks one a speaker has checked; a deck is one or the other, never both. A file with a [culture note](#notes) must carry one of them. A deck of offensive words is tagged `offensive`; until native speakers have rated its words it is seen by the Offensive words review alone, and once rated it gains the tag `rated` and follows the adult gate (#630); `rated` on a deck not tagged `offensive` is an error. | | `theme` | no | On a vocab deck: the theme it teaches, by its id in [`decks/themes.yaml`](#themes). | | `genre` | no | `culture`, `proverbs`, `multiword` or `professional`: what a deck is about beyond the path ([Deck kinds](#deck-kinds-levels-hidden-decks-sources-creators-and-topics)). On a core or a single file, never a layer. Not `kind`: that is the file's structure. | | `level` | on a genre deck | `A1` to `C2`: the lowest level the deck suits. | | `hidden` | no (`true` on `professional`) | Left out of the Decks tab, Today and the path; found by search. | | `professional` | on `professional` | A profession id from `decks/sections.yaml`. | | `section` | no | Where the Decks tab lists it; defaults to its genre's section. | | `weave` | no | Whether the courses weave its items in; defaults to its genre's. | ### `language` | Field | Required | Notes | |---|---|---| | `code` | yes | BCP-47 primary subtag, e.g. `es`, `ja`, `pt`. This is the tag voices and the app key on. | | `iso639_3` | yes | Three-letter ISO 639-3 code, e.g. `spa`, `jpn`, `hin`, `eng`. It names the language unambiguously, including languages with no two-letter code, and sits beside `code` rather than replacing it. | | `name` | yes | English name of the language. | | `script` | yes | A lowercase script name. The validator knows `latin`, `cyrillic`, `greek`, `arabic`, `hebrew`, `devanagari`, `bengali`, `gujarati`, `gurmukhi`, `odia`, `telugu`, `tamil`, `kannada`, `malayalam`, `sinhala`, `kana`, `han`, `hangul`, `thai`, `ipa`, `braille`, `sitelen_pona`, `signwriting` and `other`. Any other name is accepted with a warning ([ADR-0009](ADR-0009-Scripts-Are-Open)). Every script but `latin`, `cyrillic`, `greek`, `ipa`, `braille` and `signwriting` expects a `reading` on each card. `ipa` is for [the IPA course](#the-ipa-course) alone, and `braille` for [the English Braille course](#the-english-braille-course), whose answers are typed on the app's own braille keyboard. | | `scripts` | no | For a language written in more than one script, every script it is taught in, `script` first: `["devanagari", "perso_arabic"]` for Hindustani, `["han", "han_traditional"]` for Chinese, `["han", "kana"]` for Japanese kanji decks ([below](#japanese-kanji)). Two or more names, none twice. A card's other spellings are written under [`target_scripts`](#a-cards-other-scripts-target_scripts). A script id is lowercase words joined by an underscore (`perso_arabic`, `ol_chiki`), as the app's own list of scripts has it; the validator accepts a hyphen too. | | `tts` | no | BCP-47 tag handed to the TTS engine, e.g. `es-ES`, `pt-BR`. Defaults to `code`. Omitting it on a language with major regional variation is a mistake. | | `rtl` | no | `true` for right-to-left scripts. Defaults to `false`. A deck's text is drawn in its own direction, not the interface's: a card's target, the tiles of the word-order drill (built from the right, the words in Latin letters excepted), and where the interface quotes it, as in "Answer: …", the quote is isolated from the words around it so that neither reorders the other. | | `typed` | no | `false` for a language whose answers cannot be typed: its production is asked by choosing the word among others, in reviews, in lessons and in the check of a hard word, never by typing. Defaults to `true`. Only [the IPA course](#the-ipa-course) is `false`. [English Braille](#the-english-braille-course) is typed, on the app's own keyboard, which its script names. | | `icon` | no | What the language's chip shows: the first letter of its own name, as `"हि"` for Hindi or `"Es"` for Spanish ([ADR-0027](ADR-0027-Language-Icons)). Give the same one on every deck of the language; the validator checks that they agree. Without one, a chip shows the first letter of the language's first card. | ### `native` `{code, iso639_3, name}` — same meaning, for the learner's own language. Every language named anywhere, learned or native, carries its ISO 639-3 code. ### YAML values The validator and the app read a plain (unquoted) value the same way, as YAML 1.2 does: | Plain value | Read as | |---|---| | `true`, `True`, `TRUE`, `false`, `False`, `FALSE` | a boolean | | `[-+]?[0-9]+` | a whole number, in base 10: `060` is 60 | | `0o17`, `0x1F` | a whole number in base 8 or 16 | | `1.5`, `.5`, `1e3`, `.inf`, `.nan` | a number with a fraction | | `null`, `Null`, `NULL`, `~`, nothing | null | | anything else: `yes`, `no`, `on`, `off`, `y`, `n`, `1_000`, `1:30`, `0b101` | text | So `phrasebook: yes` is the text `"yes"`, not true, and is refused. Do not lean on the table: **quote every value that is text, and every key that is text too** (`"lo":`, `"stem":`, `"te-9001":`), as the examples below do. Only three kinds of value stay unquoted, because they are meant as what they are: booleans (`phrasebook: true`, `rtl: true`), whole numbers (`schema: 1`, `words: 45`) and `null` for an empty grammar cell. A quoted `"true"` is refused where a boolean is wanted. In a layer, and in a rules core's `table` and `rules`, a key that is not text is an error: `1:` is the number 1, and must be written `"1":`. --- ## Core and layer files A deck may be written as two kinds of file instead of one ([ADR-0036](ADR-0036-B1-Deck-Format)): - **The core** holds what belongs to the language learnt, the same for every learner: card ids, targets, readings, IPA, parts of speech, pictures, forms, [base words](#base-words-bases), the [rules](#sentences-and-their-rules-rules) a sentence uses, and the language facts of [notes](#notes). - **A layer** holds what belongs to one native language: the deck's name and description, each card's meaning, its note texts, its examples' translations, and a grammar or rules deck's labels and explanations, keyed by card id. - **Merged, they are one deck,** whose id is the layer's. A card the layer does not translate is not taught from that language: it is left out, not shown in English. So teaching a language from Bengali as well as English means adding Bengali layers; the core does not change. Every deck in a [B1 plan](#the-b1-plan) is split into a core and its layers as the plan is written. A single-file deck stays valid in every form it has, and may use every new card field. [Rules decks](#rules-decks) exist only as a core and layers; reading decks stay single-file (owner, 2026-10-14: "Keep reading decks single-file"), since their questions are already keyed by language; a deck a learner adds in the app is single-file. A language's [script guide](#script-guides) and [sounds file](#sounds-files) are split the same way, into a core that keeps their letters and a layer per native language that keeps their text (#498). The ids in the examples below, `te-9001` and on, are made up. Take real ones from `python3 tools/validate_decks.py --next-id te`. **How a file is told apart,** in this order: `kind: "layer"` is a layer (a `part` key on it is an error); else `part: "core"` is a core; else a `part` key with any other value is an error, and the file is checked as a single-file deck; else it is a single-file deck. A core is marked by `part`, never by a missing `native`, so a forgotten `native` on a single-file deck is not mistaken for a core. A single-file deck that gives `core`, `table` or `rules`, or `kind: "rules"`, is refused with a message saying it belongs in a core and layers; the app's parser refuses the same words. ### Files and ids | File | Where | Id | |---|---|---| | Core | `decks//-.yaml` | `-`: `te-home` | | Layer | `decks///--.yaml` | `--`: `te-en-home` | | The merged deck | (none) | the layer's id, `te-en-home` | - **``** matches `[a-z0-9]+(-[a-z0-9]+)*`, and is the same in the core and every layer of it. - **The merged deck's id is the id a single-file deck of that course has today,** so placement, a learner's added deck and the review log all know it unchanged, and the language's path, which lists the core id (`te-home`), does not change. Splitting `decks/te/te-en-home.yaml` into `decks/te/te-home.yaml` and `decks/te/en/te-en-home.yaml` keeps the deck id and every card id. - **Reserved names:** a deck's core is never `-facts`, `-numbers`, `-romanisation`, `-script`, `-sounds` or `-path`, the files beside the decks, and a deck's id never ends in `-script`. (The script guide and the sounds file have cores of their own under those names: a layer whose `core` is `-script` or `-sounds`, or ends in `-script`, is theirs, see [Script guides](#script-guides) and [Sounds files](#sounds-files).) - **A core's name never starts with a native language's code,** nor with the name of a folder beside it: a core `te-en-x` would read as a deck of the `te-en` course. Nor is a core's id the id of any other file of the language. - **A grammar or rules core's cells** take the core's id as their deck name: `te-grammar-past` expands to `te-grammar-past--`, exactly as the single-file `te-en-grammar-past` does ([Expansion](#expansion)). Splitting a grammar deck keeps every cell id as long as the core's id is the old deck id without its native language, and the slots keep their order. - **One namespace of card ids per language.** A card is written once in the language, in a core, a layer or a single-file deck, and `--next-id` sees all three. A core's card and a single-file deck's card with one id is refused, and so is a ref, a `pair`, a pair note or a base naming a card no deck writes. - **A core's `icon`** is held to the other decks' of the language, as a single-file deck's is. A layer has no language block and no icon. ### A core ```yaml schema: 1 id: "te-home" part: "core" kind: "vocab" language: { code: "te", iso639_3: "tel", name: "Telugu", script: "telugu", tts: "te-IN", icon: "తె" } license: "CC-BY-SA-4.0" authors: - { name: "Fluenough contributors" } theme: "home" tags: ["beginner", "unreviewed"] cards: - id: "te-9001" target: "ఇల్లు" reading: "illu" ipa: "illu" pos: "noun" picture: "🏠" notes: - { id: "stem", kind: "behaviour", words: [{ word: "ఇంటి-", reading: "iṇṭi-" }] } - id: "te-9002" target: "నేను ఇంటికి వెళ్తాను." reading: "nēnu iṇṭiki veḷtānu." pos: "phrase" rules: ["te-rule-ki"] bases: - { word: "ఇంటికి", ref: "te-9001" } - { word: "వెళ్తాను", ref: "te-9003" } - ref: "te-9010" ``` | Field | Required | Notes | |---|---|---| | `schema` | yes | `1`. | | `id` | yes | `-`, the filename stem. | | `part` | yes | `"core"`. It is what marks the file as a core. | | `kind` | no | `"vocab"` (default), `"grammar"` or `"rules"`. Not `"reading"`: a reading deck stays a single-file deck. | | `language` | yes | The full language block, `icon` included where the language's other decks give one. | | `license` | yes | SPDX, for the core's content. | | `authors`, `source`, `tags` | no | As on any deck. | | `theme` | no | On a vocab core: the theme it teaches. | | `cards` | on a vocab core | A non-empty list, below. | | `pattern` | on a grammar core | [A grammar core](#a-grammar-core). | | `table`, `rules` | on a rules core | [Rules decks](#rules-decks). | | `native`, `name`, `description` | **not allowed** | They are the learner's language: each layer gives them. | The file sits in `decks//`. A core no layer names is warned of: no learner is taught it. **A core card** has the language side only. It may give `id`, `target`, `reading`, `ipa`, `alt_target`, `target_scripts`, `pos`, `gender`, `tags`, `audio` (with `audio_credit`), `examples`, `modes`, `picture`, `image` (with `image_credit`), `notes` (the core form, below), `phrasebook`, `bases` and `rules`. It may **not** give `native`, `alt_native` or `wiktionary`, which are the native language's and go in each layer, nor `pair`: in a core a [pair note](#notes) names the partner, and the card's sound-alike is taken from it. **A set card,** `kind: "set"`, is the one other card a vocab core writes: `id`, `kind`, `members` and, for a set of one slot across the words, `shown` only ([Set cards](#set-cards)). **A core example** is `{ target, reading?, ipa?, bases?, source? }`. Its translation is in each layer, keyed by its target, so two examples of one card may not have the same target, and the target is written in Unicode's composed form (NFC), as every layer key that names it is. `source` names where an example taken from outside came from (a Tatoeba sentence, a Wiktionary quotation), per item (owner, #506: "Per item"); an example written for the deck leaves it out. A layer never gives a `source`: the sentence is the core's. How many examples a word card needs is in [Card data](#examples). **A core ref**, `- ref: "te-9010"`, lists a card written in another deck. It may give `reading`, `ipa`, `tags`, `modes`, and `examples` and `notes` in the core form; not `native`, `alt_native`, `not_synonyms` or `wiktionary`. ### A grammar core The core keeps the table's language side, and the slot labels stay the keys of `forms`: ```yaml schema: 1 id: "te-grammar-past" part: "core" kind: "grammar" language: { code: "te", iso639_3: "tel", name: "Telugu", script: "telugu", tts: "te-IN", icon: "తె" } license: "CC-BY-SA-4.0" pattern: slots: ["నేను", "నువ్వు"] entries: - lemma: "వెళ్ళు" key: "vellu" reading: "veḷḷu" forms: { "నేను": "వెళ్ళాను", "నువ్వు": "వెళ్ళావు" } readings: { "నేను": "veḷḷānu", "నువ్వు": "veḷḷāvu" } ``` A core `pattern` gives `slots` and `entries`, and each entry `lemma`, `key`, `forms`, `reading`, `readings`, `ipa` and `ipas`, under every rule of [Grammar decks](#grammar-decks). Its `name`, `slot_name`, `prompt` and `notes`, and each entry's `gloss`, are in each layer: a core that gives one is an error. ### A layer ```yaml schema: 1 id: "te-en-home" kind: "layer" core: "te-home" native: { code: "en", iso639_3: "eng", name: "English" } name: "Home and neighbourhood" description: "Rooms, the house and the street." license: "CC-BY-SA-4.0" tags: ["unreviewed"] cards: "te-9001": native: "home; house" wiktionary: true notes: "stem": "Before an ending, it becomes {1}: ఇంట్లో (iṇṭlō), at home." "te-9002": native: "I will go home." "te-9010": native: "door" "te-9020": target: "ఇంటి పేరు" reading: "iṇṭi pēru" native: "surname (literally 'house name')" bases: - { word: "ఇంటి", ref: "te-9001" } - { word: "పేరు", base: "పేరు", reading: "pēru", meaning: "name" } notes: - { kind: "culture", text: "A Telugu surname often comes first, before the given name.", source: "https://en.wikipedia.org/wiki/Telugu_people#Names" } ``` | Field | Required | Notes | |---|---|---| | `schema` | yes | `1`. | | `id` | yes | `--`, the filename stem, where the core is `-`. | | `kind` | yes | `"layer"`. | | `core` | yes | The core's id. The core is `.yaml` in the folder above the layer's. | | `native` | yes | The native language block, `{ code, iso639_3, name }`. | | `name` | yes | The deck's title, in this language. | | `license` | yes | SPDX, for the layer's text. | | `description`, `authors`, `source`, `tags` | no | As on any deck. | | `cards` | on a layer of a vocab core | A **mapping** from card id to what this language gives the card. | | `pattern` | on a layer of a grammar core | Below. | | `table`, `rules` | on a layer of a rules core | [The layer of a rules core](#the-layer-of-a-rules-core). | | `language`, `theme`, `part` | **not allowed** | They are the core's. | The file sits in `decks///`. The validator reads the core beside it even when the layer is validated alone, and checks the layer's readings against the core's language and its [romanisation file](#romanisation-files). **An entry for a card the core writes:** | Field | Notes | |---|---| | `native` | **Required.** The meaning. A card with no entry, or an entry with no `native`, is not taught from this language. | | `alt_native` | As on any card. | | `not_synonyms` | As on any card: the card's refusal of listed synonyms (ADR-0050). | | `notes` | A mapping from the core note's `id` to its text in this language ([Notes](#notes)). | | `examples` | A mapping from a core example's `target`, exactly as the core writes it, to its translation: text, or `{ native, bases }`, where `bases` gives the example's inline bases their meanings as the card's `bases` below does. | | `bases` | A mapping from the `word` of one of the core card's inline bases to its meaning: text, or `{ meaning, wiktionary }` ([Base words](#base-words-bases)). | | `wiktionary` | `true` ([The Wiktionary link](#the-wiktionary-link)). | | `dictionary` | A short entry imported from Wiktionary, `{ senses, etymology?, source }` ([A dictionary entry](#a-dictionary-entry-dictionary)). | | `explanation` | Only on a [set card's](#set-cards) entry, which gives `native`, its name, and `explanation`, both required, and nothing else. | Anything else, `target`, `reading`, `ipa`, `pos`, `tags`, `modes` and the rest, is an error on such an entry: a layer cannot change the word. **An entry for a card the core lists by `ref`:** the same fields, but `native` is optional. With it, the card has its own meaning in this deck, as a ref with `native` has today. Without it, the card takes the meaning of the card it names, through a deck of the same native language, as [a ref](#a-word-in-more-than-one-deck-ref) does; the entry may still give `alt_native` and `wiktionary`. It gives `notes` and `examples` only where the core's ref gives core-form ones for it to key on. **A card only this layer has** is an entry whose id the core does not have: a whole single-file card without its `id` line, since the key is its id. `target` and `native` are required and every card field is allowed, `pair` included, with notes in the [single-file form](#notes) and bases written in full. Its id is taken from the language's sequence like any other. Use it for what only these learners need: Bengali false friends for a Bengali speaker learning Hindi, say. A layer whose own card has a culture note is tagged `unreviewed`, as the one above is, since the claim is in the layer. **A layer of a grammar core** gives the learner's side of the pattern: ```yaml pattern: name: "Past tense" slot_name: "person" prompt: "{lemma} ({gloss}) — {slot}" slots: { "నేను": "I, నేను (nēnu)", "నువ్వు": "you, నువ్వు (nuvvu)" } entries: { "vellu": "to go" } notes: "The past adds -ఆ- (-ā-) before the person ending." ``` `name`, `slot_name` and `entries` are required, and `prompt` is retired (see [`pattern` fields](#pattern-fields)); `entries` maps each core entry's `key`, or its lemma where it has none, to its gloss, and **every core entry must have one**: the validator errors on an entry with no gloss (`gives no gloss for ...`), and on a key that is not an entry of the core. `slots` is optional: it maps a core slot to the label `{slot}` shows, and a slot without one shows its key; a key that is not a slot of the core is an error. `notes` is optional. **What the validator checks on a layer:** - **Errors:** an entry that names nothing in the core (a note id, an example's target, an inline base's word or a grammar entry the core does not have), so that a core edit cannot silently lose a translation; a missing `native` on a card the core writes; a field that belongs to the word; a text key that is not in Unicode's composed form (NFC), since a key must match the core's text letter for letter. - **Warnings:** a core note with no text here, an example with no translation, and an inline base with no meaning: learners from this language do not see them, or see the base without one. - **One info line:** `covers n of m cards of te-home (p%)`, how much of the core this layer teaches. ### What the merged deck is The app merges each layer with its core into one deck, and the validator checks the same deck: - **The deck:** the layer's id, `name` and `description`; the core's `kind`, `language` and `theme`; the layer's `native`. Its `license` is the core's when the two agree, else `" AND "`. Its tags are the core's, then the layer's, and `reviewed` is dropped when either says `unreviewed`, so a deck reads as unreviewed until both files are checked. Its authors are the core's then the layer's. - **Its cards,** in the core's order: each written card the layer gives a `native`, and each ref that has a meaning in this language, by the layer or through a deck of the same native language; a ref with neither is skipped. The layer's own cards follow, in the layer's order. Its `source` is the layer's, else the core's; its `theme` the core's. - **A merged card** takes the word from the core and the meaning, `alt_native` and `wiktionary` from the layer. Its notes are the core's, in order, each with the layer's text, its placeholders filled; a note with no text in this layer is left out. Its examples are the core's, each with the layer's translation; one without is left out. Its `pair` is the partner of its first pair note. ### Splitting a deck `python3 tools/split_deck.py decks/te/te-en-home.yaml` does all of this (#397): it writes the core and the English layer, deletes the old file, and refuses to write a split that, merged back, would not be the old deck. `--check` tries it without writing. By hand, or checking what the tool did: 1. The core is `decks//-.yaml`, its id the old deck id without the native language: `te-en-home` gives `te-home`. 2. The layer is `decks///.yaml`, with the old id. 3. **Every card id stays as it is.** A card the old deck wrote is written in the core, with its meaning, notes and translations in the layer; a ref stays a ref. A note written as text becomes a core note `{ id: "n1", kind: "note" }`, its text the layer's `"n1"`. A card's `pair`, which a core cannot give, becomes a pair note: the card's one note when it names the partner, else a new note `"pair"` whose text names the partner, its reading and its meaning. 4. A grammar deck keeps every entry's `key` and the order of its slots, so its cells keep their ids. 5. **The old file is deleted in the same change.** The validator refuses the two side by side: they have the same id. 6. **Nothing goes in `pubspec.yaml`.** The app bundles no deck: it downloads them from `decks-live` ([ADR-0037](ADR-0037-Decks-Download-From-Main)), so a new layer folder needs no asset line. `decks/index.json` is regenerated on decks-live after the merge ([How the app gets decks](#how-the-app-gets-decks-indexjson)). 7. The path does not change: it lists the deck's core id, `te-home`, which the single-file deck had too. Once a language has a core, its path needs its [B1 plan](#the-b1-plan). **Where the split stands (2026-10-13).** Every vocab and grammar deck is a core and an English layer: Hindi, Marathi, Gujarati, Kannada, Assamese and Spanish with their B1 rewrite, and Bengali and Telugu by `tools/split_deck.py` (#498: "Change them via grep", owner, 2026-10-13). Japanese (hidden) stays single-file: a language with a core needs a [B1 plan](#the-b1-plan) in its path, and Japanese has none, so `ja-en-hiragana` is not split (owner, 2026-10-16, #498: "Keep single-file"). It stays as it is until Japanese is worked on again. Each language's script guide and sounds file are split too ("Split script + sounds", owner, 2026-10-13); its path, facts, numbers and romanisation files stay one file. **Reading decks stay single-file** (owner, 2026-10-14: "Keep reading decks single-file"): the validator refuses a core of `kind: "reading"`, and `tools/split_deck.py` leaves them alone. A validator warning on a B1 deck still single-file ([The B1 plan](#the-b1-plan)) is how a language's remaining decks show. --- ## Vocab decks ```yaml schema: 1 id: es-en-core-100 name: Spanish Core 100 kind: vocab language: { code: es, iso639_3: spa, name: Spanish, script: latin, tts: es-ES } native: { code: en, iso639_3: eng, name: English } license: "CC-BY-SA-4.0" tags: [beginner, core] cards: - id: es-0001 target: la casa native: the house pos: noun tags: [noun, home] ``` ### Card fields | Field | Required | Notes | |---|---|---| | `id` | yes | The language learned and a number, `es-0001`: unique in the language, across every deck and course. **Never reuse or renumber** — review history is keyed on it. | | `target` | yes | The text in the language being learned. | | `native` | yes | The meaning, in the learner's language. | | `reading` | no | Romanisation, as the language's [romanisation file](#romanisation) says: for the Indic languages, letters based on ISO 15919, as the word is said. Required in practice for non-Latin scripts. | | `ipa` | no | How the word is said, in the IPA: broad, without the slashes, which the app adds, as `"paːlu"` ([ADR-0025](ADR-0025-Iso-15919-And-Ipa)). `tools/transcribe.py` writes one. | | `phonetic` | no | The word in a narrow IPA transcription, inside square brackets: `"[ˈkʰæt]"`. `ipa` stays broad and is still what the app compares; this is the finer form, for a pronunciation check. Written only by tools, never by hand (owner, 2026-10-26; wiki: Plan-Ipa-Revamp-And-Language-Phonology): `tools/import_phonetic.py` takes it from Wiktionary, then `tools/derive_phonetic.py` derives it by the language's [phonetic rules](#phonetic-rules-files) for a card Wiktionary has none for. Both add the two lines after the card's `ipa:` line as text and touch nothing else, and skip a card that already has a `phonetic`. IPA letters and marks only, in `[ ]`, NFC (the validator checks it). Needs `phonetic_source`. **A deck can use it only once a release that reads it is out: the released parser rejects unknown fields** (0.6.6 reads it). The app reads it and does not show it yet. **Attribution** (owner, 2026-10-30): Pronunciations in [ ] adapted from [Wiktionary](https://en.wiktionary.org), licensed [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/). The app's Sources screen carries the same line. | | `phonetic_source` | with `phonetic` | Where `phonetic` came from: `"wiktionary"` (a Wiktionary entry has this form) or `"rules"` (derived by the language's rules, so less certain). Required when `phonetic` is given, and only then. The app may treat the two differently. | | `alt_target` | no | Additional answers accepted in production drills. | | `target_scripts` | no | For a language whose block lists several `scripts`: the word spelled in each script but the first, `{ perso_arabic: "کتاب" }`. See [below](#a-cards-other-scripts-target_scripts). | | `words` | in a B1 deck in a script without spaces | The target's words, in order, `["我", "听不懂"]` for 我听不懂 (wǒ tīng bu dǒng): for Chinese, Japanese and Thai, written without spaces. Allowed on any card. See [Base words](#base-words-bases). | | `alt_native` | no | Additional meanings accepted when the meaning is typed, in Hear (ADR-0034). **An English `native` or `alt_native` separates alternatives with `;`** (`Take care!; Careful!`): the typed-meaning grader accepts each `;`-separated part and no other split, so a meaning with a sentence break (`.`, `!` or `?` then more text, outside brackets and abbreviations such as `Mr.`) and no `;` is a validator error (#924). A card whose sentences must all be said is listed in `MEANING_ALL_REQUIRED` in `tools/validate_decks.py`; the check covers a card's `native` and `alt_native`, not its examples. | | `not_synonyms` | no | Typed English answers the [synonym sets](ADR-0050-English-Synonym-Sets) must not accept for this card (ADR-0050, #924): a quoted list of words in comparison form (lower case, no leading `to`, no punctuation), each once, none of them one of the card's own answers. It is the escape for a set partner that is the wrong sense here, e.g. `not_synonyms: ["shore"]` on a river's bank. It never blocks `native` or `alt_native`. On the native side only (a single-file card, a ref, a layer's entry), English native only; a core card has none. `tools/validate_synonyms.py` reads it and refuses an entry that is in no set with another of the card's answers, and a set escaped on two cards. **Released apps reject the key, so decks do not use it until a release after the app that reads it (as for `warning`, #691).** | | `pos` | no | Part of speech: `noun`, `verb`, `adj`, `adv`, `pronoun`, `phrase`, `particle`, `other`; a script's letter or sign is `letter` and its digit `digit` (#522 step 7), and Hear asks for what was heard of it, typing its form. A [rules deck](#rules-decks) picks its rows by it, so give every word its own: a pronoun is `pronoun`, not `other`. | | `hears` | no | `form`: a word that is heard and typed as its form, as a letter or digit is, though it keeps its part of speech: a script reading or spelling word. Only `form` is a value. An app older than the release that added it rejects the card, so decks give it a release after the app that reads it (#522 step 7). | | `warning` | no | The one warning the card's teach card shows ([Which warning the teach card shows](#which-warning-the-teach-card-shows-warning)): the `id` of one of its `pair`, `homograph` or `lookalike` notes, `"senses"`, or `"none"`. A core card only. An app older than the release that added it rejects the card, so decks give it a release after the app that reads it (#691). | | `not_sounds_like`, `not_looks_like` | no | A reviewer's rejection of a [sound-alike or look-alike pair](#a-rejected-pair-not_sounds_like-and-not_looks_like): a list of the ids of the offensive words of the language that the card was found to sound like (`not_sounds_like`) or look like (`not_looks_like`), and does not. A core card only. An app older than the release that added them rejects the card, so decks give them a release after the app that reads them (#808). | | `gender` | no | Grammatical gender, as text. On a noun it is one of its language's classes, which the language's path lists (`genders`): see [Gender](#gender). | | `tags` | no | Card-level tags. Drills can be filtered by tag. In a script deck, `own-letter` marks a letter the language adds to, or writes differently from, a script it shares with other languages: Assamese ৰ (rô) and ৱ (wô) in Eastern Nagari. The app's script test, which lets a learner who reads the shared script skip the course's script lessons, always asks these (#554). | | `notes` | no | Text, or a list of typed notes: see [Notes](#notes). Shown when the word is taught and after answering. | | `audio` | no | The card's own recording, played in place of text-to-speech: `"decks/hi/audio/hi-0001.opus"`, a file shipped with the deck, with its `audio_credit`. See [A card's own recording](#a-cards-own-recording-audio). | | `audio_credit` | with a shipped `audio` | `{ source, license, credit }`: the file it was made from, its licence and its speaker. | | `image` | no | The card's own image, shown where `picture` shows and in its place: `"decks/hi/images/hi-0001.webp"`, a file shipped with the deck, with its `image_credit`. See [A card's own image](#a-cards-own-image-image). | | `image_credit` | with `image` | `{ source, license, credit }`: the file it was made from, its licence, and whom to credit. | | `examples` | no | List of `{target, native}` sentence pairs; a word card has at least 2 once its language is filled in (see [Examples](#examples)). An example may also give its `reading`, `ipa`, [`bases`](#base-words-bases), [`words`](#base-words-bases), `source`, and, for [the IPA course](#the-ipa-course), its `language` and whether it `sounds`. | | `phrasebook` | no | `true` on a survival phrase taught whole, first: see [The phrasebook](#the-phrasebook). Leave it out otherwise. | | `bases` | no | The base word of each inflected or derived word in the target and its examples: see [Base words](#base-words-bases). `"self"` on a word that is its own root ([Card data](#root-word-synonyms-and-antonyms)). | | `register` | no | How formal or rude the word is: `"formal"`, `"neutral"`, `"informal"`, `"slang"` or `"offensive"`. See [Register, forms, collocations and senses](#register-forms-collocations-and-senses). | | `frequency` | no | `{ rank, source }`: the word's rank in a count of its language, and where it was counted. See [Frequency](#frequency). | | `synonyms`, `antonyms`, `collocations`, `confusables`, `forms`, `senses` | no | A core card's [card data](#card-data), its text in each layer by id. Not on a single-file card or a layer's own card. | | `rules` | no | On a sentence: the ids of the rules it uses, `["te-rule-ki"]`. See [Sentences and their rules](#sentences-and-their-rules-rules). | | `wiktionary` | no | `true` where the learner's language's Wiktionary has an entry for the target: see [The Wiktionary link](#the-wiktionary-link). | | `modes` | no | The skills this card is excluded from (an opt-out, #522 step 6: `recognition`, `production`, `listening`, `speaking`, or `grammar` for both grammar skills). Defaults to every skill the card's data allows, except that a `pos: phrase` card is not typed: it defaults to recognition, listening and speaking, and production by rearranging its words when it has two or more (ADR-0024). | | `pair` | no | The id of a word of the language that sounds almost the same, its minimal-pair partner: `te-0111`, కాలం (kālam), time, on కలం (kalam), pen. Hear offers the partner's meaning among its options, to catch a learner who confuses the two ([ADR-0034](ADR-0034-Hear-Say-Write)). It belongs to the word, so a ref cannot give it. A [pair note](#notes) gives it too: a card without `pair` takes its first pair note's partner, and a core card has no `pair` at all, only pair notes. | | `picture` | no | One emoji, quoted, showing what a concrete word means: `"🏠"` on house. Its picture, from [Noto Emoji](https://github.com/googlefonts/noto-emoji) (Apache-2.0), is a cue beside the meaning in Write and beside each meaning Hear offers ([ADR-0034](ADR-0034-Hear-Say-Write)); it is also one of the four pictures of a picture choice, a form of Recognition, which needs four words of the deck with a picture (not a `picture_ask` one) that are not twins or the same meaning. Only for a picture that means exactly the word: not for abstract words, kinship, or near misses; the one exception is a question word that sets [`picture_ask`](#a-question-words-picture-picture_ask). Run `python3 tools/pictures.py path/to/noto-emoji` to bundle its image; the validator checks it is there. It belongs to the word, so a ref cannot give it. | | `picture_ask` | no | `true` on a question word whose `picture` asks rather than shows: the app draws the emoji with a small "?" badge on its corner. Unquoted `true` or left out, never `false`. It requires `picture`, and belongs to the word, so a ref cannot give it. See [A question word's picture](#a-question-words-picture-picture_ask). A release that reads it must be out before a deck uses it: the released parser rejects unknown fields. | | `proposed` | no | Written by the review bot: changes reviewers proposed, waiting for agreement. See [Proposals](#proposals-proposed). Allowed on any card entry: a single-file card or ref, a core's card or ref, a layer's entry. | | `checked_by` | no | Written by the review bot: the rater codes of the reviewers who signed the card off, `["FL-7K3M-Q9TD-6"]`. See [Who checked it](#who-checked-it-checked_by). Allowed on any card entry, as `proposed` is. | | `verified` | no | Written by the review bot, from the daily questions: the data points of the card two reviewers agreed are right, `["meaning", "example:1a2b3c4d", "confusable:stem", "sound"]`. See [Settled points](#settled-points-verified). Allowed on any card entry, as `checked_by` is. An app older than the release that added it rejects the card, so decks give it a release after the app that reads it (#519). | | `facet_checks` | no | Written by the review bot: what other reviewers said about each facet of the card, `{"reading": {"by": ["FL-7K3M-Q9TD-6"]}}`, with flags and fixes. See [Facet checks](#facet-checks-facet_checks). Allowed on any card entry, as `checked_by` is. An app older than the release that reads it rejects the card, so the bot writes it only after that release (ADR-0058 W9; the format is a proposal for the owner to confirm). | In a [core and its layers](#core-and-layer-files), the core card gives every field above but `native`, `alt_native`, `wiktionary` and `pair`; the layer gives `native`, `alt_native` and `wiktionary`, and the texts of the core's notes, examples and card data. ### A question word's picture: `picture_ask` A question word (where, when, who, what, why, how, which, how many) has no picture that means exactly the word, so it is the one exception to the `picture` rule above: it may take a `picture` that stands for the sense, and `picture_ask: true` to say so. The app draws that emoji with a small "?" badge on its corner (owner, 2026-10-22). `picture_ask` needs a `picture`, is only `true`, and a ref cannot give it, as with `picture`. ```yaml - id: "te-0120" target: "ఎక్కడ" native: "where" reading: "ekkaḍa" picture: "📍" picture_ask: true ``` Suggested pictures; the deck pass picks each per course and per sense, and the review confirms it: | Word | Picture | |---|---| | where | 📍 | | when | 🕐 | | who | 👤 | | what | 📦 | | why | 💭 | | how | ⚙️ | | which | 👉 | | how many / how much | 🔢 | Bundle each emoji's image with `tools/pictures.py`, as for any `picture`. ### A card's other scripts: `target_scripts` A language the learner may read in more than one script (Hindustani: Devanagari or Perso-Arabic, as Punjabi has Gurmukhi or Shahmukhi) lists them in its `language` block, `scripts: ["devanagari", "perso_arabic"]`, the deck's own `script` first. The card's `target` stays in that first script, so every card, layer and id is as it was, and the card spells the same word in each other script under `target_scripts`, a map from script id to text: ```yaml - id: "hi-0004" target: "किताब" target_scripts: { perso_arabic: "کتاب" } reading: "kitāb" ``` Toki Pona does the same with `sitelen_pona` (U+F1900 to U+F19FF, the UCSUR block), written by `tools/tok_sitelen.py`: its cards keep the Latin `target` and give `target_scripts: { sitelen_pona: ... }` ([ADR-0055](ADR-0055-Sitelen-Pona-As-A-Second-Script)). There is **one** `reading` and **one** `ipa` per card: they say how the word sounds, which every spelling shares, so a second reading is never written. A word that differs by more than its spelling (a Sanskrit-leaning synonym in Devanagari, a Persian-leaning one in Perso-Arabic) is a card of its own, or a synonym of the card, not a second spelling. `alt_target` stays in the first script. A core card gives `target_scripts`, and the layer needs nothing. The validator checks that each key is one of the language's `scripts` other than the first (so a language with one script gives none), that the text is in that script's Unicode blocks (Perso-Arabic and Shahmukhi: the Arabic blocks; Chinese, traditional or simplified: the CJK ones; a script it has no blocks for is not checked), and that it differs from `target`. The value is not "script in prose": the card's `reading` serves it. The app parses and keeps it (`Card.targetScripts`). A card shows its main text in the script the learner learns, and beneath it, smaller, its spelling in every other script the learner learns or already reads, where it has one (owner, 2026-11-22); a script they neither learn nor read is not shown. The validator's summary prints, per multi-script language, how many cards have each other script (informational, never a failure). A card's [`words`](#base-words-bases) are its target's; another spelling takes them letter for letter where it has as many letters. It is also what a backup voice says (#641). The Perso-Arabic decks are voiced `tts: "ur-PK"`. On a phone with the Hindi voice (`hi-IN`) but not the Urdu one, the Hindi voice says each card from its `devanagari` spelling, so those decks list `scripts: ["perso_arabic", "devanagari"]` and give every card a `devanagari` spelling the Hindi voice can read: a letter with its vowel (`ب` is `ब`), a word in its normal Hindi spelling. A card with no sensible spelling, such as a bare nasal mark, gives none, and no backup is said for it. ### Japanese kanji Japanese is written in kana and kanji. Its two scripts are `kana` and `han` (the app names `han` "Kanji"), and a card written in kanji is a card of a language with two scripts, so it uses the machinery above and nothing new (owner, 2026-11-02, [ADR-0053](ADR-0053-Japanese-Kanji): "From each kanji unit on, cards write the target in kanji with the kana reading shown (like Chinese hanzi with pinyin); earlier cards stay kana."). Cards before the first kanji unit are as they were: `script: kana`, one script, the target in kana. A **kanji deck** has `script: han` and `scripts: [han, kana]`. Its card's `target` is in kanji, with its okurigana where it has them, and the kana reading, the word spelled in kana, is `target_scripts.kana`: ```yaml language: { code: ja, iso639_3: jpn, name: Japanese, script: han, scripts: [han, kana], tts: ja-JP } cards: - id: "ja-0301" target: "食べる" target_scripts: { kana: "たべる" } words: ["食べる"] reading: "taberu" ipa: "tabeɾɯ" pos: "verb" ``` - **The kana reading is `target_scripts.kana`, and `reading` stays the romaji.** `reading` is the course's Hepburn romanisation, which typed romaji answers, `ipa` and the readings in prose all follow, so it does not change. The kana is the card's second spelling, so one card has one `reading` and one `ipa`, as Hindustani's two spellings do. - **Every target with a kanji in it needs a kana reading.** The validator refuses a kanji target with none, and a reading with a kanji (or romaji) in it: its letters must be hiragana, katakana (ー and ・ too) or halfwidth katakana. 々, 〆 and 〇 count as kanji. A target in kana alone (ありがとう, です, a particle) gives none: the kana is the target. - **A word that mixes the two stays one word.** 食べる and 食べました are one `words` entry each; their `bases` name the base in kanji (`base: "食べる"`) with its romaji `reading`, and the card of the base is the card whose `target` is 食べる. `words` is the target's only, as for any `target_scripts` spelling: the kana spelling has no `words` of its own and is split at spaces, since it need not have as many letters (日本語 is three, にほんご is four). - **Examples are written in kanji too, each with its kana line.** An example takes `target_scripts`, in the card's shape, and an example with a kanji in it needs `target_scripts: { kana: ... }` as a card does (owner, 2026-11-02: "Add a kana line"). The romaji `reading` stays, and the translation is in each layer, keyed by the example's `target` as before: ```yaml examples: - target: "私は食べます。" target_scripts: { kana: "わたしはたべます。" } words: ["私", "は", "食べます"] reading: "watashi wa tabemasu." ``` The kana line has no `words` of its own, like a card's. Only `target_scripts` is new on an example; an example in kana alone gives none. The app shows the kana line under the kanji example, as a card shows its kana, for a learner who learns kanji and kana, and the kana alone to one who learns kana only. - **A card id never changes when its card moves to kanji.** A card already in a kana deck keeps its id and its history; the kanji spelling lands as a new card of a kanji deck only where the word is new. **A script unit of kanji** (`script-kanji-1` to `script-kanji-38`, deck ids `ja-kanji-N`, listed under the path's `alphabet`) is a vocab deck tagged `script`, as Chinese's `characters-N` is, and its cards are single kanji: ```yaml - id: "ja-0401" target: "日" target_scripts: { kana: "ひ" } words: ["日"] reading: "hi" pos: "noun" notes: - { id: "n1", kind: "note" } examples: - target: "日曜日です。" words: ["日曜日", "です"] reading: "nichiyoubi desu." ``` The kana reading is the one reading the unit teaches the kanji by: the word it stands for alone (ひ, sun, day), or for a kanji that never stands alone, its commonest word's. The other on and kun readings are the card's notes (`日: on ニチ (nichi), ジツ (jitsu); kun ひ (hi), か (ka)`, in the layer, with the romaji beside each kana, as notes quote any word), and the kanji's use in words is taught by the examples and by the kanji word cards that follow. A learner learns kanji on top of kana. Kana is the script a Japanese course starts with, however many of its decks are kanji decks (`primaryScript`), and a learner of kana alone sees a kanji deck's cards in kana, from their `target_scripts.kana`, and leaves the kanji script units out as any skipped script's are. A learner who learns kanji sees the kanji with the kana beneath it, as the app shows a card's other spellings, and may write either: the kana spelling, which accepts the kanji too, or the kanji. A card's `target_scripts` is a field the released app reads, but **an example's `target_scripts` is new**: the released app refuses an example with a field it does not know, so a deck file that has one cannot be read by an app before this version. A kanji deck therefore lands after the release that carries this, and each such file is held to it with `decks/min_app.json` ([ADR-0052](ADR-0052-Minimum-App-Version-In-The-Deck-Index)). ### Character data (`character_scheme`, `character`) A card of a script deck (`pos: "letter"` or `"digit"`: one character on the card) may carry structured data about its character, so that a filter, a question or a search can use it instead of reading prose in a note (#1226). It is the same for every language and every script: the deck says which kinds of reading and which level schemes its characters have, and each card gives its values. No language or script is named in the app or in the tools. The deck's header (a single-file deck, or a core) names the kinds and the schemes: ```yaml character_scheme: readings: first: { name: { en: "First reading", es: "Primera lectura" }, script: "bengali" } second: { name: { en: "Second reading" }, script: "latin" } levels: grade: { name: { en: "School grade" }, values: [1, 2, 3, 4, 5, 6] } exam: { name: { en: "Exam" }, values: ["E2", "E1"] } ``` - `readings`: a mapping of kind id (`[a-z0-9-]+`) to `name` (text by language code, `en` required: what the app shows) and `script`, the script id the kind's readings are written in. A language with one way of reading a character has one kind; one with two (a Han character read two ways) has two. At least one of `readings` and `levels` is there. - `levels`: a mapping of scheme id to `name` (as above) and optional `values`, the allowed values in order, whole numbers or text, none twice. Without `values` any value is allowed. A card's block, in a core or a single-file deck (never in a layer, which carries no `character`: the validator and the app refuse it there): ```yaml - id: "zz-9801" target: "ক" pos: "letter" character: readings: - { kind: "first", text: "কা", reading: "kaa" } - { kind: "second", text: "ka" } level: { grade: 1, exam: "E2" } strokes: 4 radical: "ক" ``` | Field | Rule | |---|---| | `readings` | A non-empty list of `{ kind, text, reading? }`. `kind` is one of the header's reading kinds; `text` is the reading, written in that kind's `script` (letters and marks only are checked, as for `target_scripts`; a script the validator has no blocks for is not checked); `reading` is its romanisation, optional. The same kind and text is not listed twice. | | `level` | A mapping of scheme id to value, each scheme one of the header's `levels` and each value one of its `values` where it has them. | | `strokes` | A whole number from 1 to 64. | | `radical` | One character (one code point). | Every field is optional, but the block is not empty. The block needs the header's `character_scheme`, and the card needs `pos: "letter"` or `"digit"`. A deck that uses neither is checked as before. The app reads the block into `Card.character` and the header into `Deck.characterScheme` (`lib/core/models/character.dart`); nothing shows or drills it yet. **A released app refuses a card field it does not know, so a file that has a `character` block, or a `character_scheme`, waits for the app that reads them.** `tools/deck_index.py` writes that itself: the validator marks the file as using a new card field, and the index gives its entry `min_app` of `CARD_FIELD_MIN_APP["character"]` (today `0.10.2`, the first release that reads it), with no line in `decks/min_app.json` ([ADR-0052](ADR-0052-Minimum-App-Version-In-The-Deck-Index)). A hand entry newer than that wins; an older one does not lower it. Until the kanji tasks move over, the readings stay in the fixed note shape. The fixtures are the `zz` decks of `tools/test_validate_character.py` and `test/character_data_test.dart`. ### A note on `id` Card ids are the primary key of the user's entire review history. Changing an id orphans that card's history; reusing one silently attaches old history to new content. Treat ids as immutable once published. To retire a card, delete it — do not repurpose it. An id names the language, not the deck or the course ([ADR-0018](ADR-0018-Card-Ids-Name-The-Language)). Numbers are shared by every deck of the language, so take the next free one: ```sh python3 tools/validate_decks.py --next-id es ``` ### A word in more than one deck: `ref` A word is one card, written once. Another deck that teaches it lists it by its id, and the learner has one schedule for it, whichever deck they meet it in, and whichever language they learn it from: ```yaml cards: - ref: es-0001 notes: "In this deck: the house you live in." ``` A ref may give the card's native side for this deck: `native`, `alt_native`, `not_synonyms`, `reading`, `ipa`, `notes`, `tags`, `examples`, `modes` and `wiktionary`. What the card is in the language learned, its `target`, `alt_target`, `pos`, `gender` and `audio`, stays where it is written, and so do `phrasebook`, `bases`, `rules`, `pair` and `picture`: a ref cannot give them. - **The same native language:** what the ref does not give comes from the card. - **Another native language,** say an `es-bn` deck listing a card written in an `es-en` one: the ref gives its own `native`. The card's `notes`, `tags`, `alt_native` and `examples`, written for English speakers, do not come across; its `reading` and `modes`, which belong to the word, do unless the ref gives its own. - **A card written in a core** has its meaning in each layer. A ref to it from a single-file `te-en` deck takes the meaning the core's English layer gives it; with no English layer that translates it, the ref gives its own `native`. - `wiktionary` on a ref is its own where given; otherwise it comes from the card, as `notes` does, when the deck has the card's native language. - The validator checks that each ref names a card written in another deck of the language, and that no card is written twice. ### The phrasebook A course starts with a small phrasebook: 15 to 25 survival phrases, taught whole from the first lesson, never held back until their words are known ([ADR-0036](ADR-0036-B1-Deck-Format)). Greetings, thanks and sorry, yes and no, "I don't know Telugu", "I don't understand", "please speak slowly", and the like. ```yaml - id: "te-9100" target: "నాకు తెలుగు రాదు." reading: "nāku telugu rādu." native: "I don't know Telugu." pos: "phrase" phrasebook: true bases: - { word: "నాకు", ref: "te-9101" } - { word: "తెలుగు", ref: "te-9102" } - { word: "రాదు", base: "రా", reading: "rā", meaning: "to come; here, to know (a language)" } ``` That is the single-file form. In a core the card has no `native`, and the inline base no `meaning`: the layer gives both. - **`phrasebook: true`, unquoted,** or nothing. `false`, `"true"` and `yes` are refused. It goes on a card where the card is written, never on a ref. - **15 to 25 per course,** counted over every deck of the course, by distinct card id. The validator checks the count once a course has one phrasebook card, or a [B1 plan](#the-b1-plan). A Bengali layer's own phrasebook cards count for Bengali learners only. - **In the course's first unit.** In a course with a B1 plan, every phrasebook card is taught by a deck of the course's first unit on the path, the first it has a deck in. A later deck may list one by `ref`, as long as a first-unit deck teaches it too. - **Its words are not counted as taught by it.** Each word of a phrase comes again later as a word card, and its `bases` say which. A phrasebook card is never counted as a word of the course: not in a unit's words, not as a row of a rule's table, and not as the card that covers a word of another text ([Base words](#base-words-bases)). ### Base words: `bases` A card names the base word of every inflected or derived word in its target and its examples. For "He went to our school" the card also gives "go" and "we". They are shown with the taught details: on the lesson's teach card, and in reviews once the question is answered, never before, since on a Write question they would give the answer away. **Single-file deck, or a layer's own card:** ```yaml bases: - { word: "ఇంటికి", ref: "te-9001" } - { word: "రాదు", base: "రా", reading: "rā", meaning: "to come", wiktionary: true } ``` **In a core,** the meaning and the Wiktionary mark of a base written in full are in each layer: ```yaml bases: - { word: "ఇంటికి", ref: "te-9001" } - { word: "రాదు", base: "రా", reading: "rā" } ``` ```yaml "te-9100": native: "I don't know Telugu." bases: "రాదు": { meaning: "to come; here, to know (a language)", wiktionary: true } ``` | Field | Required | Notes | |---|---|---| | `word` | yes | The word as it stands in the text, ఇంటికి (iṇṭiki): one of the text's words, compared in Unicode's composed form and ignoring case. | | `ref` | one of `ref` and `base` | The card that teaches the base, ఇల్లు (illu). Its target, reading and meaning are shown, in the learner's language. Prefer it. | | `base` | one of `ref` and `base` | The base written in full, when no card teaches it. | | `reading` | with `base`, in a script that needs one | The base's reading. A missing one is an error here, not a warning: the app shows it. | | `ipa` | no, with `base` | The base in the IPA. | | `meaning` | with `base`, single-file only | Its meaning. In a core it is in the layer. | | `wiktionary` | no, with `base`, single-file only | `true` ([The Wiktionary link](#the-wiktionary-link)). In a core it is in the layer. | - **Examples** take `bases` the same way, on the example: `examples: [{ target: "...", reading: "...", bases: [...] }]`. A layer gives an example's inline bases their meanings under `examples: { "": { native: "...", bases: { "": ... } } }`. - **Not on a ref:** a base belongs to the text it is a word of. - A `word` is given once per text, and is a word of that text. A `ref` names a card of the language, not the card itself. `reading`, `ipa`, `meaning` and `wiktionary` are only for a base written in full. - **Errors on a base:** it gives `ref` and `base` together, or neither; its `ref` is not a card of the language, or is the card itself, or no deck writes it; its `word` is not a word of the text, or is given twice; a base written in full has no `reading` in a script that needs one; in a single-file deck it has no `meaning`; in a core it has a `meaning` or `wiktionary` (they are in the layer). Two words are the same when they are equal in Unicode's composed form, ignoring case. - **Words** are the text split at spaces and punctuation (an apostrophe inside a word is kept), with digits dropped, or, where the card or the example gives them, its `words` (below). - **A changed stem is said in the card's notes.** When the inflected form does not show its base, the card says so in one short line, so the learner sees the link. The base రావడం (rāvaḍam), to come, becomes వచ్చింది (vaccindi), she came, so that card's note reads "రావడం (rāvaḍam) changes its stem in the past: వచ్చ- (vacc-)." Every past-tense card built on it carries the line. The validator warns where a base's word does not start with its base's first letter and no note of the card, in its core or any layer, names the base: a hint, not an error, since a prefix can move the first letter without a new stem. **A pronoun is exempt** (#480): its case forms are not a new stem, so তাৰ (tār) on সি (xi) is not warned of. A base is a pronoun when its card is `pos: "pronoun"`, or its lemma is a lemma of a pronoun grammar deck. **In a [B1 deck](#the-b1-plan), every word is covered.** Each word of a target, and of each example's target, is either the target, or an `alt_target`, of a word card the course teaches (a vocab card that is neither a phrasebook card nor a phrase), or has a `bases` entry. A grammar or rules cell does not count, since an inflected form taught as a cell is still a derived word that names its base, and nor does a card taught only from another native language. Phrasebook cards are checked too. Decks on no B1 plan are not checked: they gain their bases as their language's plan is written. **A script written without spaces gives its words: `words`** (#661). Spaces cannot show where a Chinese, Japanese or Thai word ends, so a card gives its target's words, in order, and each example its own: ```yaml - id: "zh-0011" target: "我听不懂" target_scripts: { han_traditional: "我聽不懂" } words: ["我", "听不懂"] reading: "wǒ tīng bu dǒng" bases: - { word: "听不懂", base: "听懂", reading: "tīngdǒng" } examples: - target: "对不起,我听不懂。" words: ["对不起", "我", "听不懂"] reading: "duìbuqǐ, wǒ tīng bu dǒng." ``` 我 (wǒ) is a word card of the course, so it needs no base; 听不懂 (tīng bu dǒng) names its base, as an inflected word in a spaced language does. - **They join to the target.** Joined, with spaces, punctuation and symbols left out of both, the words are the target (or the example's target), in Unicode's composed form. A word has no space in it and is not a mark alone. The validator names the card and what the words join to where they do not. - **Where given, they are the text's words.** A base's `word` is one of them, B1 coverage checks each of them, a card of one word counts as a word of its unit, and the app puts a phrase's words in order by them: each word a tile, each mark between them a tile of its own. A card of two or more words is a phrase the app has put in order, as a spaced one is. - **Required in a B1 deck in a script without spaces** (`han`, `han_simplified`, `han_traditional`, `kana`, `thai`): on every card's target and every example the deck shows; the validator names each that has none ("card zh-0011: no `words`"). Elsewhere `words` is allowed and used, and a text without it is split at spaces. - **Japanese** writes its particles as words of their own: `["私", "は", "学生", "です"]`; a set phrase stays whole where a learner says it whole, `["ありがとう", "ございます"]`. - **A card's other spellings** (`target_scripts`, such as Chinese traditional characters) have no `words` of their own. The app carries the target's words over letter for letter, which is right for simplified and traditional Chinese, one character for one: 我聽不懂 is 我 and 聽不懂. A spelling with another number of letters than the target is split at spaces, as an `alt_target` always is. The validator checks the words of the target only. ### Notes Notes are a list of facts about the word, each of a kind. The app shows one at a time, when the word is taught and after an answer: shuffled, never repeated until every note of the card has been shown once. Which one is the app's choice, not the deck's (#421): the teach card and the answer reveal each show one prose note, chosen at random from the card's notes that are not a `pair`, `homograph` or `lookalike` warning, and the next showing takes one not yet shown, so every note shows once before any repeats; a new round never opens with the note that closed the last. The app remembers by card id and note id for the run of the app, so a note added later is due at once. The word sheet lists every note. A text note, and the decks written before typed notes, read as one note: nothing changes for them. `tools/propose_pairs.py` proposes `pair` notes (read-only): the words of a language whose IPA differs by one segment between very close sounds. **Typed notes need a release that reads them.** The released parser rejects an unknown note shape, so the typed list, like every new field, goes into a deck only a release after the app that reads it. The app has read it since the B1 format (ADR-0036); a deck written before is unchanged, so no deck moves to the typed list until its language's B1 plan. | Kind | What it says | |---|---| | `pair` | A minimal pair, shown with the ear icon ("Sounds like another word"): a word of the language whose IPA differs by exactly one segment, and only between very close sounds, such as a short and long vowel (e/eː), an unaspirated and aspirated consonant (k/kʰ) or a dental and retroflex one (t̪/ʈ). Its text names that sound difference. It names the partner by `ref` (owner, 2026-10-22). | | `homograph` | The same spelling as another word of the language, with a different sound or meaning. Shown with the ear-off icon ("Looks like another word"); its text is about the spelling. It names that word by `ref`, like `pair`. | | `lookalike` | Differs from another word only by a dot, a length mark or another short mark, such as a nukta. Shown with the ear-off icon ("Looks like another word"); its text says how the spelling differs, not how it sounds (owner, 2026-10-22). It names that word by `ref`, like `pair`. | | `culture` | The word's cultural significance. It names its `source`. | | `usage` | Another context it is used in, or another sense. | | `behaviour` | How it behaves unlike similar words: an irregular form, a gender, a use. | | `note` | Anything else worth knowing. | **Single-file deck, or a layer's own card:** ```yaml notes: - { kind: "pair", ref: "te-9007", text: "Not కాలం (kālam), time: the a is long there." } - { kind: "homograph", ref: "te-9008", text: "Spelled like కలం (kalaṁ), a pen, but read with another vowel: a different word." } - { kind: "lookalike", ref: "te-9009", text: "Only the dot differs from కలం (kalaṁ), a pen." } - { kind: "culture", text: "A pen was a gift for the first day at school.", source: "https://example.org/telugu-school-customs" } - { kind: "usage", text: "Also a pen-name, in old usage." } - { kind: "behaviour", id: "plural", text: "Its plural is {1}.", words: [{ word: "కలాలు", reading: "kalālu" }] } - { kind: "note", text: "A word from Arabic, through Persian." } ``` | Field | Required | Notes | |---|---|---| | `kind` | yes | `pair`, `homograph`, `lookalike`, `culture`, `usage`, `behaviour` or `note`. | | `text` | yes | The note, in the deck's native language. [Script in prose](#script-in-prose-always-with-its-reading) applies. | | `id` | no | The note's id: starts with a letter, `[a-z0-9-]+`, not one of `yes`, `no`, `on`, `off`, `true`, `false`, `y`, `n`, and unique in the card. Without one, a note's id is its place, `"1"`, `"2"`. The app remembers which notes it has shown by card and note id, so give ids once a card's notes may be reordered. | | `ref` | on a `pair`, `homograph` or `lookalike` note, and only there | The other word: another card of the language. For a `pair`, the partner that sounds almost the same; for a `homograph`, the word with the same spelling; for a `lookalike`, the word that differs by a mark. | | `source` | on a `culture` note; optional on the rest | Where the claim can be checked: a URL, or a book with its author and year. | | `words` | no | The words of the language the text quotes, `{ word, reading, ipa? }`, `reading` required in a script that needs one. The text names them `{1}`, `{2}` (below). | | `region` | no | On a note of any kind: the [regions](#regions) of the language it is about, a region id or a list of them, each a region of the language's path. | `notes` may still be text, as every deck had it: it reads as one note of kind `note`. An empty string is no notes. A list may not be empty. **A region note** says how the word is used, or heard, in some of the language's regions: regional vocabulary, or an offensive word whose raters from different regions differ by a band or more. On ఉల్లిపాయ (ullipāya), onion: ```yaml notes: - { kind: "usage", region: "telangana", text: "In Telangana often {1}.", words: [{ word: "ఉల్లిగడ్డ", reading: "ulligaḍḍa" }] } ``` A region is a fact about the language, the same for every learner, so in a core it is on the core's note, `{ id: "telangana", kind: "usage", region: "telangana", words: [...] }`, and each layer gives the text by the note's id. **In a core,** a note keeps its language facts, and each layer writes the explanation around them. A core note has an `id`, required, and no `text`, and `notes` in a core is always a list, never a string; a culture note's `source` is in the core, shared by every layer, and a layer cannot add its own: ```yaml notes: - { id: "pair", kind: "pair", ref: "te-9007" } - { id: "same", kind: "homograph", ref: "te-9008" } - { id: "dot", kind: "lookalike", ref: "te-9009" } - { id: "school", kind: "culture", source: "https://example.org/telugu-school-customs" } - { id: "plural", kind: "behaviour", words: [{ word: "కలాలు", reading: "kalālu" }] } ``` The layer gives each note's text by its id: ```yaml "te-9005": native: "pen" notes: "pair": "Not to be confused with కాలం (kālam), time: the a is long there." "school": "A new pen was a gift for the first day at school." "plural": "Its plural is {1}." ``` **Placeholders.** In a note's text, and in a rule's explanation, `{1}`, `{2}` … `{12}` stand for the first, second and twelfth of the note's (or the rule's) `words`, shown as the word and its reading in brackets: `{1}` above reads కలాలు (kalālu). So the word and its reading are written once, in the core, and every layer shows the same. `{0}` and `{01}` are errors, and so is a number past the last word; a word the text never uses is warned of. Any other brace is just a brace. A layer may still quote a word directly, with its reading. **What the validator checks on notes:** - **A warning on a word card with no notes,** in a [B1 deck](#the-b1-plan): every word card should have one or more. A word card is a vocab card that is not a phrasebook card or a phrase, and is one word, or a noun, verb, adjective, adverb or pronoun of several. - **A pair note's partner is taught in the same course,** so that it has a meaning in the learner's language: the minimal-pair panel shows the two words side by side, each with its reading and meaning. It is an error when no deck of the course teaches the partner. A layer that cannot teach the partner leaves that note's text out. When the panel is built, it shows its button only where the partner is in the catalog in the learner's native language, so a deck a learner adds cannot open a panel on a word with no meaning. - **A homograph or lookalike note's `ref` follows the pair note's rules** but for the minimal-pair panel: it is a card of the language, not the card itself, and a card some deck writes. It need not be taught from the learner's language, since no panel shows the two words side by side yet. - **Errors on a note:** a `kind` other than the seven; no `text` in a single-file note; a `ref` on a note that is not `pair`, `homograph` or `lookalike`, on one of those that names its own card or no card of the language, or that no deck writes; no `source` on a culture note; a `region` that is not a region of the language's [path](#regions); an `id` used twice in a card; an empty list. An all-blank string reads as no notes. - **A warning on a card with `pair` and no pair note naming the partner,** in a B1 deck: the minimal-pair button needs the note. - **Culture notes keep a deck marked.** A file that holds a culture note's claim (a core with one, a single-file deck with one, a layer whose own card has one) carries `unreviewed` until a speaker checks it, then `reviewed`: one of the two, never both (#99). The tag belongs to the file that holds the claim: the core for a core card's culture note, the layer for a layer's own card. A layer may carry `unreviewed` for its own texts too. ### Which warning the teach card shows: `warning` A word can warn of several things: a word it sounds like (`pair`), a word it looks like (`homograph`, `lookalike`) and its other meanings (`senses`). The teach card has room for one, so a core card says which with `warning` (owner, 2026-10-23: "Deck field picks it"). The [word sheet](#notes) still shows every one of them, titled. ```yaml - id: "te-0110" target: "కలం" warning: "pen-sound" # the id of one of this card's notes notes: - { id: "pen-sound", kind: "pair", ref: "te-0111" } - { id: "same", kind: "homograph", ref: "te-9008" } ``` | Value | The teach card shows | |---|---| | The `id` of a `pair`, `homograph` or `lookalike` note | That note's warning. A note written without an `id` is named by its place in the list, `"1"`, `"2"`. | | `"senses"` | The word's other meanings. The card must have `senses`. | | `"none"` | No warning, for a word whose only warning is a rude word that is not close and rude enough to show. | - **Without the key** the card keeps the fixed order: a rude word it is like, else the word it sounds like, the word it looks like, then its other meanings. - **A rude word** is picked only when it is very close (its IPA differs by at most one segment) and very rude (the partner's `level` is `strong` or `strongest`). Otherwise another warning, or `"none"`. - **Errors:** a value that is not text; one that names no `pair`, `homograph` or `lookalike` note of the card; `"senses"` on a card with no `senses`; `warning` on a card that is not a core card's. - **A new deck sets `warning` when it is written** (owner, 2026-10-23: "Newly written decks will choose the order when building"), choosing the warning that matters most to the learner. A reviewer can change it. For decks already written, `tools/pick_warning.py` fills the field: the most important warning wins, equals are drawn at random seeded by the card id, and a card that already has a `warning` is left alone. - **Two releases.** Released apps reject a card key they do not know, so the app and the validator learn `warning` first and the decks set it one release later, as for `hears`. ### A rejected pair: `not_sounds_like` and `not_looks_like` `tools/offensive_alikes.py` lists the words that sound (IPA, one segment apart) or look (one letter or mark apart) like an offensive word of their language, and the validator warns of each pair that no note explains ([Plan: offensive words](Plan-Offensive-Words)). A reviewer keeps a real pair with a `pair` note (sound) or a `lookalike` or `homograph` note (writing). A pair the reviewer rejects, because the two words are not alike enough to need care, is recorded on the card instead (owner, 2026-10-24, #808), by the kind of closeness rejected: ```yaml - id: "te-9901" target: "విధవ" not_sounds_like: ["te-9951"] # the offensive word's id not_looks_like: ["te-9951"] ``` Each is a list of the ids of other cards of the language. A pair is rejected for the kind named only: a card that rejects the sound still has its look-alike warning until a note or `not_looks_like` explains it. Either word of the pair may carry the key, the offensive word or the other. The tool lists the pair as explained, and the validator does not warn of it. - **Errors:** a value that is not a non-empty list of card ids of the language; an id twice; the card's own id; an id no deck writes; the key on a card that is not a core card's. - **Two releases.** Released apps reject a card key they do not know, so the app and the validator learn these keys first and the decks use them one release later, as for `warning`. Until a release that reads them is out, the check "Released app reads the decks" in CI fails on any deck that uses one; do not work around it. Rejected pairs are recorded once that release is out. ### A dictionary entry: `dictionary` A layer's entry may carry a short entry imported from Wiktionary, in the layer's language: the word's other meanings, and where it comes from. It is the native language's, so it is never in a core. ```yaml "te-9001": native: "home; house" wiktionary: true dictionary: senses: ["household", "family", "a square of a chessboard"] etymology: "From Proto-Dravidian *il, house." source: "https://en.wiktionary.org/wiki/ఇల్లు" ``` | Field | Required | Notes | |---|---|---| | `senses` | yes | A non-empty list of the word's other meanings, each text in the layer's language. | | `etymology` | no | Text, in the layer's language. | | `source` | yes | The Wiktionary page the entry was imported from, `https://en.wiktionary.org/wiki/`: the page only, with no fragment or query, as for any `source` that names Wiktionary. It is the credit that CC BY-SA 4.0 asks for, which is why it is required. | Anything else is an error. `dictionary` goes with [the `wiktionary` mark](#the-wiktionary-link) but does not need it: `wiktionary: true` says an entry exists, `dictionary` carries a copy of part of it. Only the layer's own entry for a card of its core may carry it; a layer's own card (one the core does not have) and a set card's entry may not. The app does not show it yet. ### The Wiktionary link The app links a word to its Wiktionary entry, with its etymology, in the learner's own language's edition: `https://en.wiktionary.org/wiki/ఇల్లు#Telugu` for ఇల్లు (illu), taught from English. The link is built from the word, not stored. What is stored is that the entry exists: ```yaml "te-9001": native: "home; house" wiktionary: true ``` - **`true`, or left out where that Wiktionary has no entry.** Nothing else is accepted. Many words of the Indian languages have none yet. - **It belongs with the native language,** since en.wiktionary may have a Telugu word that bn.wiktionary lacks: on a single-file card or ref, in a layer's entry, or on a base written in full. Never in a core. - **The title is the target.** For a base given by `ref`, it is that card's target; for a base written in full, its `base`. A card whose target is not an entry's title, such as a sentence or an inflected form, is not marked: its bases carry the mark for their words. - **Mark only an entry you have seen:** the word's own page, with a section for the language. `tools/mark_wiktionary.py` marks the cards of a core from Wiktionary's extracts ([Deck tools](Deck-Tools#mark_wiktionarypy)); mark a base written in full by hand, checking its page. - **In the app,** a word's sheet shows "Wiktionary: " for the card itself and for each marked base word, which opens the page in the browser (the address for English Wiktionary ends in the language's section, such as `#Telugu`; Hindustani's is `#Hindi`; another edition's has none, since its headings are in its own language). Nothing is fetched until it is tapped, and a word without the mark has no link. The key is not new, so decks that use it need no release guard. ### A card's own recording: `audio` Owner, 2026-10-13 (#518): "No stream, download and ship with deck". A card may have a recording of a person saying it, played in place of the phone's text-to-speech voice. It is an Opus file beside the deck, named by the card's id, and it downloads with the deck, so it plays offline: ```yaml - id: "hi-0001" target: "घर" audio: "decks/hi/audio/hi-0001.opus" audio_credit: { source: "https://commons.wikimedia.org/wiki/File:Hi-घर.ogg", license: "CC-BY-SA-4.0", credit: "A. Speaker" } ``` - **Exactly the card's text** (owner: "If the phrase itself exists then the sound can be used"). A recording is only ever of the word or phrase the card teaches, never joined from recordings of its words. Sentences, examples, and any card without its own recording are spoken by text-to-speech ("Sentences will still be tts"). - **The file** is `decks//audio/.opus`, and `audio` names it by that path. It belongs to the word: on a core card or a single-file card, never in a layer, and a ref cannot give it. Every file in the folder is named by its card; a file no card names is an error. - **`audio_credit`** is required with it: `source`, the file it was made from (its Wikimedia Commons page); `license`, its licence as an SPDX-like id; and `credit`, the speaker as the source credits them. The licence is one that can ship in a CC BY-SA 4.0 deck ([ADR-0040](ADR-0040-Decks-Are-Cc-By-Sa)): `CC0-1.0`, `public-domain`, or `CC-BY` or `CC-BY-SA` from 2.0 to 4.0, ported versions too (`CC-BY-SA-3.0-DE`). GFDL alone, NC and ND cannot. The deck screen shows each credit, and Settings' Sources screen each language's. - **The file is compressed** (owner, 2026-11-21: "Use a sound format that can compress the sounds to save space (16bit, max 128kbps ogg format)"; [ADR-0059](ADR-0059-Sounds-Decks-With-Compressed-Audio)). The validator reads the file's own bytes, with no ffmpeg, and refuses one that is not **Ogg Opus** (it starts `OggS` and its first packet is `OpusHead`; Ogg Vorbis, WAV and MP3 are refused), not **mono**, over **128 kbps** (the file's size over its length, which comes from the last Ogg page's granule position) or over **16 kB** (16,384 bytes). All the decks' recordings together may not pass **50 MB**. Encode with `ffmpeg -c:a libopus -ac 1 -b:a 32k`: about 32 kbps is what an isolated sound or word needs, a quarter of the cap. A card with no `audio` stays valid: the phone's text-to-speech says it. - **The credit is checked**: `source` is the link of the recording's page (`http` or `https`; the one exception is audio the repository's own tools made, such as the Morse tones, whose licence is `CC0-1.0` and whose source says `Generated by tools/