Git Product home page Git Product logo

similus's Introduction

Similus

Similus is a Ruby library that allows to find similar objects and recommendations using generated activity. Examples of usage:

  • Find similar articles based on what other users also viewed.

  • Recommend articles to users based on their activity.

Authors

Horaci Cuevas <[email protected]>

Robert R. Meyer <[email protected]>

Quick overview

  • Setup

  • Store activity

  • Show similar objects

  • Show recommended objects

Setup

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_host = "localhost"
  config.redis_port = "6379"
  config.redis_username = "myredisuser"
  config.redis_password = "Password"
  config.redis_db = 8
end

Store activity

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

Show similar objects

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
end

Show recommended objects

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)
  end
end

Configuring and installing Similus

As of current version, Similus only supports redis backend.

Install Redis 2.0 from [code.google.com/p/redis/] and start the server.

Install the Similus gem:

gem install similus

License

Copyright © 2010 Horaci Cuevas

See LICENSES for details.

similus's People

Contributors

blue-dog-archolite avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.