memorize Package

admin Module

class memorize.admin.PracticeAdmin(model, admin_site)[source]

Bases: django.contrib.admin.options.ModelAdmin

Makes all fields of Practice visible on admin site.

algorithm Module

Implemements the spacing algorithm.

memorize.algorithm.calculateEasyFactor(oldEF, rating, repetition)[source]

Calculate new easy factor from old factor and rating.

EF’ := f(EF,q) where,

EF’ = new value of the easiness factor EF = old value of the easiness factor q = user difficulty rating (1-4) f(EF,q) = EF-0.8+0.28*q-0.02*q*q
Parameters :
  • oldEF (float) – An factor for calculating the next repetition interval.
  • rating (int) – Difficulty rating for the item in question. From 0 (impossible) to 5 (easiest).
  • repetition (int) – Number of repetitions until now.
Returns:

int – minutes until next practice float: new easiness factor

memorize.algorithm.calculateInterval(repetition, rating, easy_factor)[source]

Calculate the inter-repetition interval

I(1):= r/2 I(2):= r for n>2 I(n):=I(n-1)*EF
where:
I(n) - inter-repetition interval after the n-th repetition (in days) EF - easiness factor reflecting the easiness of memorizing and retaining a given item in memory. r - Rating, given by the user.
The calculation is done recursively. Details at:
http://www.supermemo.com/english/ol/sm2.htm
The deviation from SM-2 consists in the following details:
  • The default interval for the first and second repetition is not fixed to 1 and 6, but relative to the user rating.
Parameters :
  • repetition (int) – Number of repetitions until now.
  • easy_factor (float) – easiness factor
Returns:

int – days until next practice

memorize.algorithm.interval(repetition, rating, easy_factor=2.5)[source]

Simplified SM-2 spacing algorithm.

It is loosely based on the SuperMemo 2 algorithm. Details at:
http://www.supermemo.com/english/ol/sm2.htm
Parameters :
  • repetition (int) – Number of repetitions until now.
  • rating (int) – Difficulty rating for the item in question. From 0 (hardest) to 4 (easiest).
  • easy_factor (float) – An factor for calculating the next
Returns:

int – minutes until next practice float: new easiness factor

models Module

Defines the Practice Model for keeping track of practice sessions.

class memorize.models.Practice(*args, **kwargs)[source]

Bases: django.db.models.base.Model

This model saves the learning stats of a user linked to a specific item.

The Practice model uses the django.contrib.contenttypes.models.ContentType framework to link it to a generic other object. This way, it can be used to keep track of learning progress of any other kind of model.

content_type ForeignKey

PK of the learnable object

object_id int

ID of the learnable object

item GenericForeignKey

Combines the above.

started_last_viewing DateTimeField

Starting time of the most recent learning.

ended_last_viewing DateTimeField

Ending time of the most recent learning.

user User

The user who is practicing.

next_practice DateTimeField

Calculated next time of practice.

times_practice int

Number of times the item has been practice by the user.

easy_factor float

An arbitrary number roughly representing the difficulty of the item for the user.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Practice.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Practice.content_type
Practice.get_next_by_next_practice(*moreargs, **morekwargs)
Practice.get_previous_by_next_practice(*moreargs, **morekwargs)
Practice.item

Provides a generic relation to any object through content-type/object-id fields.

Practice.objects = <django.db.models.manager.Manager object at 0x7f67de16a790>
Practice.user

views Module