Skip to content
Elixir SimHash NIFs written in Rust
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
config
lib
native/simhash
test
.formatter.exs
.gitignore
LICENSE
README.md
logo.png
mix.exs
mix.lock

README.md

SpiritFingers

"Fast SimHash NIFs written in Rust 🐇💨 as Erlang/Elixir versions were too slow 🐢"

logo

Versions

  • Elixir ~> 1.8
  • OTP 21
  • Rust 2018 ~> 1.32 (9fda7c223 2019-01-16)
  • Rustler 1.19.1

Build

mix compile

Test

mix test

Installation

Add spirit_fingers to your list of dependencies in mix.exs:

def deps do
  [
    {:spirit_fingers, "~> 0.2"}
  ]
end

Usage

Generate SimHash:

SimHash.simhash("wow")
{:ok, 17399923637769257768}

Similarity between strings:

SimHash.similarity("Hocus pocus", "Hocus pocus pilatus pas")
{:ok, 0.9375}

Hamming Distance between hashes:

SimHash.hamming_distance(17399923637769257768, 17399923637769257768)
{:ok, 0.0}

Similarity between hashes:

SimHash.hash_similarity(17399923637769257768, 17399923637769257768)
{:ok, 0.0}
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.