A small companion to my Anki learning. It uses Anki Deck in the background. It draws cards from the deck and stitches them into novel sentences I can translate as drills — either direction. The point is to test recognition in combinations the deck never showed me, not to memorise fixed examples.
Options
- Deck — which deck to draw from.
- Count — how many sentence pairs to produce per batch (1–100).
- Direction —
en→thshows English as the prompt;th→enis the reverse. - Pattern — the sentence frame.
anypicks at random from whatever the deck supports; the named patterns (transitive,intransitive,linking,motion-place,motion-source,intrans-locative,serial) lock in a specific syntactic shape. - Tags — comma-separated tag filter. Only cards matching at least one of the listed tags are eligible.
- adj / particle / preverb / adverb / aspect / time — independent probabilities (0–1) that the matching modifier slot is filled in any given sentence. Push them all to 1 for dense sentences; to 0 for bare SVO frames.
How it works
Every card carries semantic tags. Generation then runs roughly as:
- Filter and index. Apply the tag filter if any, then group the remaining cards into pools keyed by their semantic role.
- Pick a pattern. If
any, choose uniformly from the patterns the current pool can actually support; if a specific pattern is requested but the pool lacks the required roles, error out rather than degrade silently. - Fill the frame. The pattern defines an ordered sequence of slots. Required slots draw a random card from the matching pool. Each optional modifier slot is filled iff its probability roll succeeds against the user’s slider.
- Resolve the preverb bundle. Negation, tense, and modal are mutually exclusive — they share a single roll, so at most one ever appears in a sentence.
- Order and render. Tokens are sorted into a canonical slot order matching Thai sentence structure. The Thai side prints as-is; the English side mirrors Thai word order with articles and prepositions intentionally dropped, so the prompt reads as a near-gloss the learner has to grammaticalise themselves.
- Project the direction. Depending on the toggle, English or Thai becomes the prompt and the other becomes the answer.
The shape is structured randomness — the deck supplies vocabulary, the patterns supply skeletons, the sliders supply the difficulty dial.