"Fast SimHash NIFs written in Rust 🐇💨 as Erlang/Elixir versions were too slow 🐢"
- Hex Package.
- Documentation.
- Simhash Benchmarks TL;DR 400-900x faster, orders of magnitude more memory efficient and handles large binaries where others cannot.
mix compile
mix test
- Elixir ~> 1.14
- OTP 25
- Rust 2021 ~> 1.67.0
- Rustler 0.27.0
Add spirit_fingers to your list of dependencies in mix.exs:
def deps do
[
{:spirit_fingers, "~> 0.5"}
]
endGenerate SimHash:
SpiritFingers.SimHash.similarity_hash("wow")
{:ok, 17399923637769257768}Similarity between strings:
SpiritFingers.SimHash.similarity("Hocus pocus", "Hocus pocus pilatus pas")
{:ok, 0.9375}Hamming Distance between hashes:
SpiritFingers.SimHash.hamming_distance(17399923637769257768, 17399923637769257768)
{:ok, 0.0}Similarity between hashes:
SpiritFingers.SimHash.hash_similarity(17399923637769257768, 17399923637769257768)
{:ok, 1.0}