Skip to content

grobie01/cardgen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cardgen

A simple tool to generate Anki flashcards for learning Chinese.

Usage

Set your OpenAI API key in .env

OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Add phrases to the phrases.txt file in English or Chinese. File can be a mix of both. Phrases just need to be newline separated.

To run:

python cardgen.py

You can additionally specificy a particular input file using the --filename flag.

python cardgen.py --filename my_phrases.txt

If you wish to use elevenlabs to generate audio, you will need to set the XI_API_KEY environment variable.

To run with elevenlabs, use the --eleven flag.

Anki

To use in Anki, click Import File and select flashcards.txt.

To get the audio working correctly, you will need to add the audio files in the generated zhaudio folder to Anki's collection.media folder.

open ~/Library/Application\ Support/Anki2/User\ 1/collection.media

It's a bit annoying but if you want the to use the audio on mobile, the collection.media folder cannot have nested directories, so you just have to move the files from zhaudio to the top level.

Flashcards

This generates two types of flashcards:

  1. Type 1: English phrase front Type 1: English phrase front

  2. Type 2: Chinese audio front Type 2: Chinese audio front

Happy hunting!

About

Generate Chinese flashcards for anki

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages