Okubo is a simple spaced-repetition gem for learning items, such as words in a foreign language, which you can use with your own Active Record models.
Pull request Compare This branch is 11 commits behind rgravina:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Okubo Build Status Code Climate

Okubo is a simple spaced-repetition system which you can associate with Active Record models to be learned (such as words in a foreign language) and users in your system. Users study these words, and as they mark these attempts right or wrong, Okubo will determine when they should be reviewed next.

Okubo determines the next study time for an item using the Leitner System. In the future it may support other popular algorithms, such as the Supermemo 2 algorithm.


Add to Gemfile (will put on rubygems once at 0.1):

gem 'okubo', :git => "git://github.com/rgravina/okubo.git"


bundle install
rails generate okubo
rake db:migrate

Quick Start

Assume you have an application allowing your users to study words in a foreign language. Using the has_deck method you can set up a deck of flashcards that the user will study:

class Word < ActiveRecord::Base

class User < ActiveRecord::Base
  has_deck :words

user = User.create!(:name => "Robert")
word = Word.create!(:kanji => "日本語", :kana => "にほんご", :translation => "Japanese language")

You can add words and record attempts to guess the word as right or wrong. Various methods exist to allow you to access subsets of this collection:

# Initally adding a word
user.words << word
user.words.untested #=> [word]

# Guessing a word correctly
user.words.known #=> [word]

# Guessing a word incorrectly
user.words.failed #=> [word]

# Listing all words
user.words #=> [word]

As time passes words need to be reviewed to keep them fresh in memory:

# Three days later...
user.words.known #=> []
user.words.expired #=> [word]

Guessing a word correcly several times in a row results in the word taking longer to expire, and demonstrates mastery of that word.

# One week later...
user.words.expired #=> [word]
# Two weeks later...
user.words.expired #=> [word]
# One month later...
user.words.expired #=> [word]


In addition to an expired method, Okubo provides a suggested reviewing sequece. A word is randomly chosen from all untested words first, followed by studied, failed, and finally expired in order of precedence. If no words remain to be studied nil is returned:

user.words.review_next #=> word
# ... continuing until all untested, failed, and expired words have been guessed correctly.
user.words.review_next = nil


Chuhi is a Rails application which uses Okubo to schedule words. Have a look at the project source for real world usage. You can also use the app online!


  • activerecord-reputation-system - for providing the design and implementation from which this gem is based.
  • randym - for enouraging me work on this gem in the first place.
  • Tokyo Rails - for providing collaboration evenings where this gem was worked on.
  • Reviewing the Kanji - for providing a great visual representation and implementation of the Leitner system.

Copyright and License

Okubo © 2012 by Robert Gravina. Okubo is licensed under the MIT license. Please see the LICENSE document for more information.