AnkiRB - spaced repetition flashcards made in ruby

Donald Hutchison bio photo By Donald Hutchison Comment

In the past few weeks I discovered Omniglot and Anki and thought it’d be pretty cool to be able to create flashcards for the useful phrases listing. Being able to say “this guy pays for everything” in Turkish, or “my hovercraft is full of eels” in Norwegian could be an incredibly useful life skill.

And so AnkiRB came into existence.

The library basically replicates what the application itself does when you create flashcards via the gui, except uses ruby’s sqlite package to create flashcards and bundle media files together.

With a combination of this and some jQuery, its pretty easy to grab all the phrases + sound files for a language and create flashcards for them.

require 'ankirb'

#create a deck
deck = Anki::Deck.new 'FancyExampleDeck'

#create a basic card
card = Anki::Card.new(:front=>"What is the french for cheese omelette?", :back=>"Omelette au fromage")

#add audio to the back
card.back << "dexters_lab_omelette.wav"

#add card to the deck
deck.add_card card

#export to ~/Anki/Decks/FancyExampleDeck.apkg
Anki::apkg.export deck, "~/Anki/Decks"
comments powered by Disqus