How to make your own Anki deck that includes all the sentences you want from Tatoeba with audio (updated 12/2020)

Note: If you don't know what Anki is, read the Wikipedia article on Anki.

I decided to make a program to make an Anki deck from sentences on Tatoeba, with audio. It's not perfect but I tried it and found quite useful for me. I tested it under Linux Ubuntu. It should work under any other common operating system since it's written in Python 3. You can import as many sentences as you want from any list or favorite page. I tested it with list 4022 and my favorites.

Short instructions for Windows users

  • You must have Anki installed on your computer. If not, you can get it from the Anki site. It's easy to install.

  • If you don't have Python or it's not version 3+, you should install it.

  • Download the script from https://github.com/explanacion/Tatoeba-anki-deckgeneration

  • Put into any folder and open Tatoeba_anki.py with a text editor. (Note that Python treats tabs and spaces differently, so you may want to use a text editor that displays them differently, and enable this feature. Avoid using any text editor, such as Notepad, that inserts a byte-order mark at the beginning of the file. Notepad++ works well, and is free.) All you need to do is to edit at least 4 variables on the top of the file. For example, you want to make Anki cards from the quotes of Barack Obama with audio and translations into your language. You set the first variable, UrlListOfSentences, as follows:

    UrlListOfSentences = 'https://tatoeba.org/eng/sentences_lists/show/4022/none/'

The link must be to a list of sentences, a list of favorites, or a list of a user's sentences. The program does not work properly with advanced search results.

If, for instance, your native language is French and you are only interested in English sentences from this list, set srclang as follows:

srclang = ["eng"] 

It should be in square brackets because you can set several languages within a list:

srclang = ["eng","spa"]

Add the following:

set audio3letterslangcodes = ["eng"] 

This will be the same as srclang, use should use 3 letter language codes, as on Tatoeba.

Finally, add this:

targetlang = "fra" 

Use only one target language per deck.

  • Save the file and close it. Run Tatoeba_anki.py and wait for a while. If the program is working correctly, you should see a black console window that will close in a while. After this, you will see a new folder 'foranki' in the same directory. This folder contains the csv file and media files with audio.

  • Optionally, add this:

    copymediafilestoankifolder = True

and set the ankimediafolder variable to the desired value. If you don't do this, you will have to manually copy all mp3 files into the Anki media folder, which is called collection.media and can usually be found in your Documents folder.

  • Open Anki and import new deck of cards. Choose 'exampledeck.csv' as a source.

You can get the source code from Tatoeba-anki-deckgeneration and edit it however you like. It should work with most Python 3 varieties.

Once you have imported the deck, you can export it as a pkg file and use it on your cell phone. I have tested it.

Contents

Article available in: