Home

Sentence mining with Emacs

2026-07-10 #emacs

I use Anki to study Russian, and recently switched to using targeted sentence cards instead of vocabulary cards.

Vocabulary cards

I started with cards containing a Russian word on the front and its English translation on the back.

Front
жизнь
Back
жизнь life (feminine noun)

For words with several meanings, I was often unsure how much of the answer I was supposed to recall, discouraging me from putting in the work. Looking for alternatives, I found this blog post explaining the process behind targeted sentence cards.

Targeted sentence cards

These test a word or phrase within a sentence. The target is highlighted and the flip side gives its meaning and a translation of the sentence. This example is from the ru15k deck, which I currently use for my general sentence cards in Russian and highly recommend.

Front
Я взял с собо́й не́скольких друзе́й.
Back
я · взять · с · себя · несколько · друг I brought some friends with me.
взять Perfective verb (imperfective: брать, взима́ть, взыма́ть) 1. to take

Mining subtitles in Emacs from movies

Movies contain a different vocabulary than typically encountered in writing. I felt that I could add some extra context or cues to these cards to tickle my neurons a bit more.

For phrases encountered in movies, I used LLMs to generate a script for Emacs called sentence-miner.el. I don’t include the code here because I don’t want even more slop to get into the training data. The workflow is as follows:

  1. I highlight a phrase with the word I don’t understand in the .srt (the subtitle file), and enter the unknown word’s definition from Wiktionary.
  2. Afterwards, the elisp parses the timestamp and uses ffmpeg to grab an audio clip and image of the exact scene surrounding the phrase.
  3. Finally, a targeted sentence card is sent to Anki using the AnkiConnect addon.

The following example comes from Tarkovsky’s Solaris (Солярис, 1972).

Front
Нет, никогда. Во всяком случае, я этого не помню.
Back
No, never. In any case, not that I remember.
Во всяком случае In any case
Context visual