Mikael Couzic Mikael Couzic - 4 months ago 91
Java Question

Open Source implementation of a Spaced Repetition Algorithm in Java

I work on a project where Spaced Repetition is essential, however I am not a specialist on the subject and I am afraid to reinvent the square wheel. My research pointed me two different systems, namely the Leitner system and the SM family of algorithms.

I haven't decided yet which system would best fit into my project. If I was to take a SM orientation, I guess I would try to implement something similar to what Anki uses.

My best option would be to use an existing Java library. It could be quite simple, all I need is to compute the time for the next repetition.

Has anyone heard of such an initiative ?

Answer

I havent looked at ankis implementation but have you seen this one? SRS with Java.

basically it goes like this

public static void calcuateInterval(Card card) {
  if (card.getEFactor() < 3) {
      card.setCount(1);
  }
  int count = card.getCount();
  int interval = 1;
  if (count == 2) {
      interval = 6;
  } else if (count > 2) {
     interval =  Math.round(card.getInterval() * card.getEFactor());
  }
  card.setInterval(interval);
}

If you really want the Ankis Algorithm, look through the source of Anki in Android available in Github. It is GPL though so you might need to buy a license.

Comments