This is a script for automatically creating Anki cloze cards using sentence examples from Reverso for language learning. It leverages the unofficial Python Reverso API.
Given a list of strings, it will create a CSV file that can be used to create Anki notes with three columns:
- Term
- Example sentences from Reverso, with cloze
- Reverso's translation of the definition in the example sentences
- Top N frequencies of definitions (e.g., a word can have different meanings)
It can easily be combined with AwesomeTTS or FawsImageSearch to generate cards with audio and images.
This README assumes basic background knowledge of Anki cards and does not explain any of the related terminology.
The script creates a file reverso.csv
that can be imported into Anki. If you're interested in
exactly what's generated, you can look in the spoiler below. Otherwise, continue
reading.
a memoria,"Studialo bene ed imparalo {{c1::a memoria}}.
È fuori questione imparare tutte queste frasi {{c1::a memoria}}.
Cantatelo {{c1::a memoria}}, o leggendolo.",by heart | by heart | from memory,<b>by heart</b></br>from memory (0.27); in memory (0.12)
After creating a note type and importing the CSV, you'll have cloze cards that have the following respective front and back sides:
Using this assumes basic knowledge of how to run programs on the command line. Coding is not required.
Install the prerequisites:
pip3 install progress
- Gather terms: Create a file called
queries.txt
with one Reverso search term per line. - Run the script: Run
python3 reverso_note_maker.py -s it
whereit
(Italian) can be replaced by the two letter language code. Wait for it to finish. - Import the file to Anki: Import the created file
reverso.csv
into the Anki desktop app, with the columns matching in the order shown below. You will have to create a new note type. - Add a card template: If you'd like cards that look like the examples, check the
templates/
folder for some example card templates that you can simply copy-paste into Anki's card template editor.
To see the full list of options:
python3 reverso_note_maker.py --help
- Sleeping: If your computer goes to sleep, you'll need to restart the script, but it'll pick up from where you left off.
- Rate-limiting: Reverso may block or throttle you. The script waits one second between requests and has a retry mechanism, but if it happens, run the script again.
- Bad translations: Reverso isn't always perfect, so sometimes the translations will be weird. This is will happen frequently with less common terms.