A lightweight recommendation engine for Ruby apps using Redis. Inspired by DEVIEW presentation and recommendable gem.
Add this line to your application's Gemfile:
gem 'dessert'
And then execute:
$ bundle
Or install it yourself as:
$ gem install dessert
-
It is highly recommended to use background jobs like Resque or Sidekiq when calling
like
/unlike
methods, because there is a bit of computation work. -
Every rater and ratable items should have an
id
method. -
Hidden items will not be recommended.
- Include
Dessert::Rater
on yourUser
model.
class User
include Dessert::Rater
attr_accessor :id
def initialize(id)
@id = id
end
...
end
- Define any class that can be rated.
class Movie
attr_accessor :id
def initialize(id)
@id = id
end
end
- Like, Unlike, Hide, Unhide items.
user = User.new(1)
movie = Movie.new(483)
user.like(movie)
user.unlike(movie)
user.hide(movie)
user.unhide(movie)
- Now recommend to users!
user = User.new(1)
user.recommended_for(klass: Movie, offset: 0, limit: 10)
Bug reports and pull requests are welcome on GitHub.
InJung Chung / @mu29
The gem is available as open source under the terms of the MIT License.