Anki Assistant is a Node.js application that helps you create and update Anki decks for language learning. It allows you to input words or phrases in your native language, translates them to your target language, and adds them as cards to an Anki deck.
It uses Anthropic for fluent translations and Narakeet for audio generation.
Clone this repository:
git clone https://github.com/yourusername/anki-assistant.git
cd anki-assistant
Install the required dependencies:
npm i
Set up the environment variables:
npm run setup
Open the .env
file and update the following environment variables:
ANTHROPIC_API_KEY=your_anthropic_api_key
NARAKEET_API_KEY=your_narakeet_api_key
NATIVE_LANGUAGE=your_native_language # The language you speak
TARGET_LANGUAGE=your_target_language # The language you want to learn
NATIVE_LANGUAGE_VOICE=your_native_language_voice # The voice to use for the native language audio
TARGET_LANGUAGE_VOICE=your_target_language_voice # The voice to use for the target language audio
Replace the placeholder values with your actual API keys and preferences.
You will need API keys for both Anthropic and Narakeet.
Run the application:
npm start
Follow the prompts in the console:
The application will create an Anki deck file (.apkg
) in the project directory.
Import the generated .apkg
file into Anki to see your new cards.
In addition to the interactive mode, you can process multiple phrases at once using batch mode:
Create a phrases.txt
file in the project directory (you can copy from phrases.txt.example
):
cp phrases.txt.example phrases.txt
Then edit phrases.txt
with your phrases, one per line:
# Lines starting with # are ignored as comments
hello
goodbye
thank you
how are you
Run the batch processor:
npm run batch
For each phrase, the application will:
This is particularly useful when you have a list of phrases prepared in advance.
You can also create audio learning tapes that combine multiple phrases into a single MP3 file. Each phrase follows this pattern:
This format is particularly useful for listening and pronunciation practice, when you may not be able to read the text.
Create an audio-phrases.txt
file in the project directory (you can copy from audio-phrases.txt.example
):
cp audio-phrases.txt.example audio-phrases.txt
Then edit audio-phrases.txt
with your phrases. You can either:
Add just the native language phrase:
I usually eat breakfast at home
She can speak three languages very well
The cat likes to sleep under the table
Or include both native phrase and translation, separated by ---
:
I usually eat breakfast at home --- Es parasti ēdu brokastis mājās
She can speak three languages very well --- Viņa var ļoti labi runāt trīs valodās
The cat likes to sleep under the table --- Kaķim patīk gulēt zem galda
If you provide translations, they will be used directly. Otherwise, the application will generate translations automatically.
Run the audio tape creator:
npm run audio
The application will:
The output will be saved as [TARGET_LANGUAGE]_audio_tape.mp3
in your project directory.
For more information and the source code, visit the GitHub repository.