Skip to content

joel-shor/AEAG

Repository files navigation

NEAG (aNother Easy Anki Generator)

Spend your time learning a language, not making flashcards

By shor.joel@gmail.com (Joel Shor)

Intro

This project generates Anki flashcards for language learning. Some sources suggest that the the most useful language-learning flashcards only have the target language, images, and audio in the target language (ex Fluent Forever), and this program generates cards in this style.

This program does the following:

Input:

  1. A CSV of English words

Actions:

  1. Translates words to target language
  2. Performs extra behavior (like stripping diacritics, if necessary)
  3. Fetches images associated with the word
  4. Fetches audio of native speakers reading the translation
  5. Writes media files to Anki's media directory
  6. Generates a CSV file so Anki can import the words and media

Outputs:

  1. Writes images and audio to the target directory (often the Anki media directory)
  2. Writes a CSV file with English, translation, audio, image, and side information

Currently, AEAG does not do the following:

  1. Actually import the notes into the desired deck.
  2. Generate the Anki card layout
  3. Set up external API accounts that you might need (Google Cloud account, etc)

How to use

Before you do anything, check to make sure that the public APIs are as expected. You'll need to get credentials for these services, or email shor.joel@gmail.com to use the author's. Add them to credentials.py.

Getting and testing credentials

  1. Follow the instructions at the top of images.py to get Google Custom Search Engine credentials. Information can be found at "https://developers.google.com/custom-search/".

  2. If Google Text-To-Speech doesn't have your desired language, you might need to use Forvo. Go to "https://www.forvo.com" and sign up to receive a Forvo API key.

Once your credentials are added, check that the APIs are as expected:

python check_public_apis.py

You can also check that the code hasn't suffered from bit rot:

./run_unittests.sh

Generating cards

There are two main modes. One does all the above. The second assumes you've already downloaded the media that you want, and instead just copies them to the target directory and writes the Anki import CSV. This mode is useful if you've run out of external API quota, or you want to manually control which media is associated with which card.

To run in the first mode, run:

python main.py \
--input_file=/User/test/words.csv \
--output_dir=/anki/media/folder \
--output_csv_file=/csv/for/anki/to/import

If you've already downloaded the media you want, run something like:

python main.py \
--input_file=/User/test/words.csv \
--output_dir=/anki/media/folder \
--output_csv_file=/csv/for/anki/to/import \
--already_downloaded_media_dir=/path/to/downloaded/media

That's it!

About

Another Easy Anki Generator (AEAG)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published