Thanks to visit codestin.com
Credit goes to github.com

Skip to content
forked from yoshoku/annoy-rb

Annoy.rb provides Ruby bindings for the Annoy (Approximate Nearest Neighbors Oh Yeah).

License

lugray/annoy.rb

 
 

Repository files navigation

Annoy.rb

Build Status Gem Version License Documentation

Annoy.rb provides Ruby bindings for the Annoy (Approximate Nearest Neighbors Oh Yeah).

Installation

Add this line to your application's Gemfile:

gem 'annoy-rb'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install annoy-rb

Note: Annoy.rb does not require the installation of another external library.

Documentation

Usage

require 'annoy'

f = 40 # length of item vector that will be indexed.
t = Annoy::AnnoyIndex.new(n_features: f, metric: 'angular')

1000.times do |i|
  v = Array.new(f) { rand }
  t.add_item(i, v)
end

t.build(10) # 10 trees.
t.save('test.ann')

u = Annoy::AnnoyIndex.new(n_features: f, metric: 'angular')
u.load('test.ann')
p u.get_nns_by_item(0, 100) # will find the 100 nearest neighbors.

License

The gem is available as open source under the terms of the Apache-2.0 License.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/yoshoku/annoy.rb. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

About

Annoy.rb provides Ruby bindings for the Annoy (Approximate Nearest Neighbors Oh Yeah).

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 73.7%
  • Ruby 16.1%
  • C 10.2%