spacedr
Spaced Repetition API
Enhance your learning speed with Spaced Repetition technique. It uses increasing intervals of time between card reviews.
But now you have API. Create cards, organise them into decks, study and actually review.
And there is no session object to pass it everywhere.
Installation
$ pip install spacedrUsage
At first, you need to import the module:
>>> import spacedrAnd initialise the database:
>>> spacedr.db_init()Create a deck
>>> spacedr.create_deck(name='Test Deck', description='Just a test.')Get a deck
You can get a deck id from a card (which you get using get_cards_to_review or get_cards_to_study functions):
>>> deck_id = card.deck_idAnd then use this to get the deck object.
>>> deck = spacedr.get_deck_by_id(deck_id)Create a card
>>> spacedr.create_card(deck,
... question='What is the meaning of life?',
... answers=[42, '42'])Update a card
You have to update a card each time the user answers.
If answer is right, card's level will be increased, othervise decreased. And the card will be postponed accordingly.
>>> spacedr.update_card(card, answer='43')Get cards to study
You will get a number of cards (limited by ``num``*)*, that haven't been practiced, in the given deck.
>>> spacedr.get_cards_to_study(deck, num=20)
[...]Get cards to review
You will get a number of cards, that need to be reviewed, in the given deck.
>>> spacedr.get_cards_to_review(deck)
[...]Edit a deck
You have to pass name and description as keyword arguments:
>>> spacedr.edit_deck(deck, name='test2', description='new one')Edit a card
You have to pass deck_id (replace to an another deck), question and answers as keyword arguments:
>>> spacedr.edit_card(card, deck_id=deck_id, question='What is life?',
... answers=[42])Delete a deck
The cards assigned to given deck will be deleted too:
>>> spacedr.delete_deck(deck)Delete a card
>>> spacedr.delete_card(card)Export a deck
Export the deck from a file descriptor:
>>> with open('mydeck.json', 'w') as file_d:
... spacedr.export_deck(deck, file_d)Import a deck
Import the deck from a file descriptor:
>>> with open('mydeck.json') as file_d:
... spacedr.import_deck(deck, file_d)Note
The deck and the cards will be imported as new ones. The old won't be removed.