How to make your own Anki deck that includes all the sentences you want from Tatoeba with audio
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 Windows 7. It should work under any other common operating system since it's written in Python 2.7. 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 2.7, you can just download this zip archive.
Unzip it 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 = ["en"]
It should be in square brackets because you can set several languages within a list:
srclang = ["en","es"]
Add the following:
set audio3letterslangcodes = ["eng"]
This will be the same as srclang, but using 3 letter language codes, as on Tatoeba.
Finally, add this:
targetlang = "fr"
Use only one target language per deck.
Save the file and close it. Run Prepare_deck.bat 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.
If you have another operating system You can get the source code from Tatoeba-anki-deckgeneration and edit it however you like. It should work with most Python 2.x 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.