Skip to content
/ okubo Public

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.

License

Notifications You must be signed in to change notification settings

rgravina/okubo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

89 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

Installation

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

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

Run:

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
end

class User < ActiveRecord::Base
  has_deck :words
end

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.right_answer_for!(word)
user.words.known #=> [word]

# Guessing a word incorrectly
user.wrong_answer_for!(word)
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.

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

Reviewing

In addition to an expired method, Okubo provides a suggested reviewing sequence for all unknown words in the deck. Words are randomly chosen from all untested words, failed, and finally expired in order of precedence.

user.words.review #=> [word]
user.right_answer_for!(word)
# ... continuing until all untested, failed, and expired words have been guessed correctly.
user.words.review #=> []

You can also just get the next word to review:

user.words.next #=> word
user.right_answer_for!(word)
# ... continuing until all untested, failed, and expired words have been guessed correctly.
user.words.next #=> nil

Examples

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!

Thanks!

  • 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.

About

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.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages