Coder Social home page Coder Social logo

too's Introduction

Too

Build Status

Too is a simple recommendation engine built on top of Redis in Go.

Installation

Install Too using the go get command:

$ go get github.com/hjr265/too

The only dependencies are Go distribution and Redis.

Usage

te, err := too.New("redis://localhost", "movies")
if err != nil {
	log.Fatal(err)
}

te.Likes.Add("Sonic", "The Shawshank Redemption")
te.Likes.Add("Sonic", "The Godfather")
te.Likes.Add("Sonic", "The Dark Knight")
te.Likes.Add("Sonic", "Pulp Fiction")

te.Likes.Add("Mario", "The Godfather")
te.Likes.Add("Mario", "The Dark Knight")
te.Likes.Add("Mario", "The Shawshank Redemption")
te.Likes.Add("Mario", "The Prestige")
te.Likes.Add("Mario", "The Matrix")

te.Likes.Add("Peach", "The Godfather")
te.Likes.Add("Peach", "Inception")
te.Likes.Add("Peach", "Fight Club")
te.Likes.Add("Peach", "WALL·E")
te.Likes.Add("Peach", "Princess Mononoke")

te.Likes.Add("Luigi", "The Prestige")
te.Likes.Add("Luigi", "The Dark Knight")

items, _ := te.Suggestions.For("Luigi", 2)
for _, item := range items {
	fmt.Println(item)
}

// Output:
// The Shawshank Redemption
// The Matrix

Batch Operations

te, err := too.New("redis://localhost", "movies")
if err != nil {
	log.Fatal(err)
}

te.Likes.Batch([]too.BatchRaterOp{
  {
    User: "Sonic",
    Items: []too.Item{
      "The Shawshank Redemption",
      "The Godfather",
      "The Dark Knight",
      "Pulp Fiction",
    },
  },
  {
    User: "Mario",
    Items: []too.Item{
      "The Godfather",
      "The Dark Knight",
      "The Shawshank Redemption",
      "The Prestige",
      "The Matrix",
    },
  },
  {
    User: "Peach",
    Items: []too.Item{
      "The Godfather",
      "Inception",
      "Fight Club",
      "WALL·E",
      "Princess Mononoke",
    },
  },
}, true) // The last command is about auto update the similars and Suggestions table

Documentation

Contributing

Contributions are welcome.

License

Too is available under the BSD (3-Clause) License.

Inspiration

This project is inspired by the very existence of the awesome project Recommendable.

too's People

Contributors

dukex avatar hjr265 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

too's Issues

Weightred relations

Is there a way to introduce weighted relations. Something like:
te.Likes.Add("Mario", "The Godfather", "4")

where 4 is some kind of "weight" given to the link relative to other weights provided?

Improve engine

Let's say I want to add 50 likes in a sec.

Suggestions and Similarities are going to be updated 50 times during query.

Can I somehow manually run update after I added 50 likes.

Because current implementation is going to burn CPU

Thanks

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.