Un Mal Principio, Bien Traducido
Building a sentence-aligned Spanish reader out of a childhood favourite, then a Zipf-frequency vocabulary pipeline that turned it into 500 Anki flashcards.
I took Spanish through the end of high school, then let it sit for a long time. I still do Duolingo every day and I like it, but it feels like work: discrete little exercises that don’t add up to something I’d choose to do on a Sunday afternoon. I’ve tried a couple of the vocabulary-annotated readers built for learners too, and they have the same problem. They’re designed to teach you, and you can feel it in every sentence.
What doesn’t feel like work is A Series of Unfortunate Events. My siblings and I read the whole series as kids, so I already know that the Baudelaire orphans lose their parents in a fire, that Count Olaf is after their fortune, that nothing works out the way you’d want it to. Reading Un Mal Principio, the Spanish edition of the first book, removes the part of language learning that usually makes it effortful: there’s no plot to lose track of while I stop to look up a word, because I already know what happens. What’s left is a nice, slightly nostalgic hour with a book I like, that happens to be in the language I’m trying to get back.
So I built a reader for it, then a way to turn it into flashcards.
A sentence-by-sentence reader
The tool takes a Spanish epub I own and produces a new epub formatted as alternating pairs, sentence by sentence:
Spanish sentence. English sentence.
The English isn’t lifted from any existing published translation. It’s generated fresh, sentence by sentence and in source order, by Claude Opus. For Un Mal Principio: 13 chapters, 1,657 sentences, translated end to end for $2.43.
The alternation is sentence-level rather than paragraph-level. My first attempt grouped a whole paragraph of Spanish followed by the whole paragraph of English, and on a Kindle that made it hard to tell which English sentence matched the one Spanish word I didn’t recognise. Sentence by sentence, the answer is always the line directly underneath it.
Why this only runs one way
Un Mal Principio is a real, published translation. Néstor Busquets Tusquets translated Lemony Snicket’s English original into Spanish for the Spanish-language edition. My tool runs in the opposite direction only, Spanish to English, and only as a personal reading aid: a sentence-by-sentence gloss to get me through a book I already know and love, not a translation meant for anyone else to read.
The reverse direction, generating a new Spanish translation from the English original, is roughly the same amount of engineering work. I’m deliberately not doing it. That stops being a comprehension aid and starts being the actual job Busquets Tusquets was hired to do, with judgment calls about tone, rhythm and idiom that a batch API call isn’t making. I have a lot of respect for that work, and no interest in automating around it.
Five hundred words worth learning
Once I had a bilingual copy of the book, the obvious next step was flashcards. The hard part wasn’t the flashcards, it was deciding which words deserved one. Too common and I’m drilling words I already know. Too rare and I’m drilling trivia I’ll never see again.
The fix was to score every word in the book against how common it is in everyday Spanish, using the wordfreq library’s Zipf scale, and keep only the middle band: not so common I already know it, not so rare it’s not worth the flashcard. I calibrated the band against my own vocabulary. Words I clearly already know, like mirar (to look), querer (to want or love) and casa (house), all score above 4.5. Agachar (to crouch), which I gave as my own example of a word I don’t know, scores 2.65. Properly niche words, like rosbif (roast beef) or gorgonzola, score below 2.
That gave a band of 2.5 to 4.6 on the Zipf scale: common enough to be worth learning, rare enough that I probably don’t already know it.
Where the cut lands
That band alone contains 1,328 candidate words, out of 2,049 distinct content-word lemmas in the whole book (nouns, verbs, adjectives and adverbs, collapsed to their dictionary form, with names and function words already stripped out). That’s still too many flashcards. So I ranked the candidates by how often each one actually recurs in the book, then by how generally useful it is in Spanish, and kept the top 500.
Ranking by recurrence first means the words I’m most likely to run into again top the list. The single most frequent word in the entire kept range is garfio, hook, which shows up 51 times for two reasons: one of Count Olaf’s henchmen has hooks instead of hands, and Violet spends a whole chapter building and throwing her own grappling hook to try to climb the tower and rescue Sunny. Huérfano, orphan, appears 45 times, for equally obvious reasons. Agachar only appears 3 times and still made the cut, because even at that frequency it beats most of the 1,328 candidates on general usefulness.
Each of the 500 flashcards pairs the word with a short contextual gloss and the actual sentence it came from, in both languages, generated by Claude Haiku for $0.07 total across all 500. The card for garfio reads:
garfio (noun) hook
¡El garfio había funcionado! The hook had worked!
Closing
All in, a bilingual edition of the book and 500 flashcards built from it cost about $2.50: $2.43 to translate the book with Claude Opus, seven cents to gloss the vocabulary with Claude Haiku. Less than the coffee I drank while reviewing the flashcard list.
The code for both stages is public on GitHub. It ships no text from any real book, obviously, so there’s a small invented Spanish story bundled in instead, enough to run the whole vocab-to-Anki pipeline end to end before you ever touch your own epub. The frequency band is a config value, not a hardcoded assumption, so it’s meant to be recalibrated against whatever your “I know this, I don’t know that” split actually looks like.