Similus is a Ruby library that allows to find similar objects and recommendations using generated activity. Examples of usage:
Find similar articles to another one based on what other users also viewed.
Recommend articles to a user based on similar activity of other users.
Horaci Cuevas <firstname.lastname@example.org>
Show similar objects
Show recommended objects
Before using Similus, you need to setup the redis configuration. In rails this can be done inside a preinitializer in the config/preinitializers folder.
Similus.config do |config| config.backend = :redis config.redis_server = "localhost:6379" config.redis_db = 8 end
Locate where you want to store activity. For example, in Ruby on Rails, inside the show method of the ArticlesController class:
class ArticlesController < ApplicationController def show @article = Article.find(params[:id]) Similus.add_activity(current_user, :show, @article) end end
Once there is some activity stored by users, you can query for similar objects:
class ArticlesController < ApplicationController
def show @article = Article.find(params[:id]) @similar_articles = Similus.similar_to(@article) end
Even better than just showing similar articles, show recommended articles for the user's previous activity when there is a logged in user:
class HomeController < ApplicationController
def index @recommended_articles = Similus.recommended_for(current_user, :target => "Article") end
As of current version, Similus only supports redis backend. Thus, you need the redis gem and a redis server started.
Install Redis 2.0 from [code.google.com/p/redis/]
Install the redis gem
gem install redis
Install the Similus gem
gem install similus
Copyright © 2010 Horaci Cuevas
See LICENSES for details.