/spaced-repetition-tools

Scripts for generating flashcards.

Primary LanguagePythonMIT LicenseMIT

spaced-repetition-tools

This repository contains scripts for generating flashcards for import into Mochi. Most of these are based on Gwern's scripts.

Notes

All scripts read from stdin and write their output as a CSV to stdout.

You will want to import these into a deck with no set template, since some of the flashcards have two-sides (question-answer) and some of them have one side (cloze deletions).

sequence.py

Synopsis

Given a sequence, this script generates flashcards to remember that sequence. The cards are:

  1. A test card that asks you to recall the entire sequence.
  2. A cloze card that asks you to fill one element of the sequence.
  3. For each element of the sequence:
    1. A forward card that asks you to recall the element from its position.
    2. A backward card that asks you to recall the position of a given element.
    3. A successor card that asks you what comes after a specific element.
    4. A predecessor card that asks you what comes before a specific element.

Usage

cat sequence.txt | ./sequence.py > output.csv

Format

The input is plain text. The first line is the title of the sequence, the subsequent lines are the elements.

Example

Given a greek.txt file like this:

Greek Alphabet
Alpha
Beta
Gamma

This script will generate these flashcards:

Question Answer
Greek Alphabet: Recall all elements of the sequence Alpha, Beta, Gamma.
Greek Alphabet: What element has position 1? Alpha.
Greek Alphabet: What element has position 2? Beta.
Greek Alphabet: What element has position 3? Gamma.
Greek Alphabet: What is the position of Alpha? 1.
Greek Alphabet: What is the position of Beta? 2.
Greek Alphabet: What is the position of Gamma? 3.
Greek Alphabet: What comes after Alpha? Beta.
Greek Alphabet: What comes after Beta? Gamma.
Greek Alphabet: What comes before Beta? Alpha.
Greek Alphabet: What comes before Gamma? Beta.

Plus the cloze card:

Cloze
Greek Alphabet: Elements of the sequence: {{Alpha}}, {{Beta}}, {{Gamma}}.

poetry.py

Synopsis

Given a poem, this script generates flashcards where you are given some context (the previous two lines) and have to recall the next line.

Usage

cat poem.txt | ./poetry.py > output.csv

Format

The input is plain text. The first line is the title of the sequence, the second line is the author, and subsequent lines are the poem.

Example

Given a wasteland.txt file like this:

Archaic Torso of Apollo
Rainer Maria Rilke
We cannot know his legendary head
with eyes like ripening fruit. And yet his torso
is still suffused with brilliance from inside,
like a lamp, in which his gaze, now turned to low,
...

This script will generate these flashcards:

Question Answer
Beginning
...
We cannot know his legendary head
Beginning
We cannot know his legendary head
...
with eyes like ripening fruit. And yet his torso
We cannot know his legendary head
with eyes like ripening fruit. And yet his torso
...
is still suffused with brilliance from inside,
with eyes like ripening fruit. And yet his torso
is still suffused with brilliance from inside,
...
like a lamp, in which his gaze, now turned to low,

And so on.

Mochi Import

  1. Create a new deck (don't set a template).
  2. Click import, CSV, double quote as the quote character.
  3. Find the output file.
  4. Select the deck you just created.

License

Copyright (c) 2023 Fernando Borretti.

Released under the MIT license.