{"id":27168923,"url":"https://github.com/joshrotenberg/strsim_ex","last_synced_at":"2026-05-19T05:31:35.540Z","repository":{"id":57554174,"uuid":"259507650","full_name":"joshrotenberg/strsim_ex","owner":"joshrotenberg","description":"An Elixir wrapper around the Rust strsim crate with rustler.","archived":false,"fork":false,"pushed_at":"2021-02-14T00:25:55.000Z","size":96,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-01T16:14:25.790Z","etag":null,"topics":["elixir","levenshtein","rust","rustler","strsim"],"latest_commit_sha":null,"homepage":null,"language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/joshrotenberg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-28T02:15:34.000Z","updated_at":"2025-02-05T02:17:46.000Z","dependencies_parsed_at":"2022-09-26T19:30:19.441Z","dependency_job_id":null,"html_url":"https://github.com/joshrotenberg/strsim_ex","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshrotenberg%2Fstrsim_ex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshrotenberg%2Fstrsim_ex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshrotenberg%2Fstrsim_ex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshrotenberg%2Fstrsim_ex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joshrotenberg","download_url":"https://codeload.github.com/joshrotenberg/strsim_ex/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247657268,"owners_count":20974346,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["elixir","levenshtein","rust","rustler","strsim"],"created_at":"2025-04-09T06:21:59.035Z","updated_at":"2025-10-24T15:42:56.013Z","avatar_url":"https://github.com/joshrotenberg.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Strsim\n\n[![Hex pm](http://img.shields.io/hexpm/v/strsim.svg?style=flat)](https://hex.pm/packages/strsim)\n![Elixir CI](https://github.com/joshrotenberg/strsim_ex/workflows/Elixir%20CI/badge.svg)\n![License](https://img.shields.io/hexpm/l/strsim)\n![Hex.pm](https://img.shields.io/hexpm/dw/strsim)\n[![Coverage Status](https://coveralls.io/repos/github/joshrotenberg/strsim_ex/badge.svg?branch=master)](https://coveralls.io/github/joshrotenberg/strsim_ex?branch=master)\n\nStrsim is an [Elixir][0] wrapper for the [Rust][1] [strsim][2] crate with [Rustler][3].\n\n## Summary\n\nStrsim is a NIF-based bridge for the [strsim][2] [Rust][1] library which implements the following string similarity algorithms:\n\n* Levenshtein\n* Damerau-Levensthein\n* Jaro\n* Jaro-Winkler\n* Hamming\n* Optimal String Alignment\n* Sørensen–Dice\n\nThe crate offers several functions for both strings and generic sequences, and this library exposes all of them except for the generic Damerau-Levenshtein for now.\n\n## Usage\n\nAll of the functions in the crate have equivalent Elixir functions:\n\n```\niex(1)\u003e Strsim.damerau_levenshtein(\"ab\", \"bca\")\n{:ok, 2}\n\niex(2)\u003e Strsim.generic_hamming([1, 2], [1, 3])\n{:ok, 1}\n\niex(3)\u003e Strsim.generic_jaro([1, 2], [1, 3, 4])\n{:ok, 0.611111111111111}\n\niex(4)\u003e Strsim.generic_jaro_winkler([1, 2], [1, 3, 4])\n{:ok, 0.6499999999999999}\n\niex(5)\u003e Strsim.generic_levenshtein([1, 2, 3], [1, 2, 3, 4, 5, 6])\n{:ok, 3}\n\niex(6)\u003e Strsim.hamming(\"hamming\", \"hammers\")\n{:ok, 3}\n\niex(7)\u003e Strsim.hamming(\"hamming\", \"ham\")\n{:error, :different_length_args}\n\niex(8)\u003e Strsim.jaro(\"Friedrich Nietzsche\", \"Jean-Paul Sartre\")\n{:ok, 0.39188596491228067}\n\niex(9)\u003e Strsim.jaro_winkler(\"cheeseburger\", \"cheese fries\")\n{:ok, 0.9111111111111111}\n\niex(10)\u003e Strsim.levenshtein(\"kitten\", \"sitting\")\n{:ok, 3}\n\niex(11)\u003e Strsim.normalized_damerau_levenshtein(\"levenshtein\", \"löwenbräu\")\n{:ok, 0.2727272727272727}\n\niex(12)\u003e Strsim.normalized_levenshtein(\"kitten\", \"sitting\")\n{:ok, 0.5714285714285714}\n\niex(13)\u003e Strsim.osa_distance(\"ab\", \"bca\")\n{:ok, 3}\n\niex(14)\u003e Strsim.sorensen_dice(\"ferris\", \"feris\")\n{:ok, 0.8888888888888888}\n```\n\n## Benchmarks\n\nEverybody loves benchmarks. There are results for all implemented [strsim](bench/strsim_benchmark_results.md) \nas well as [jaro](bench/jaro_benchmark_results.md), [jaro_winkler](bench/jaro_winkler_benchmark_results.md), [levenshtein](bench/levenshtein_benchmark_results.md) and [hamming](bench/hamming_benchmark_results.md) comparing the Rust and various Elixir implementations.\n\nTo run the benchmarks:\n\n```\n# run Elixir vs Rust Jaro benchmarks\n$ MIX_ENV=bench mix bench.jaro \n\n# run Elixir vs Rust Jaro-Winkler benchmarks\n$ MIX_ENV=bench mix bench.jaro_winkler \n\n# run Elixir vs Rust levensthein benchmarks\n$ MIX_ENV=bench mix bench.levenshtein\n\n# run Elixir vs Rust hamming benchmarks\n$ MIX_ENV=bench mix bench.hamming\n\n# run a benchmark will all of the Rust functions\n$ MIX_ENV=bench mix bench.strsim\n\n# run 'em all\n$ MIX_ENV=bench mix bench.all\n```\n\n## See also\n\n* [fuzzy_compare][4]\n* [levenshtein][5]\n* [String.jaro_distance/2][6]\n* [the_fuzz][7]\n* [simetric][8]\n\n## Installation\n\nThe package can be installed\nby adding `strsim` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:strsim, \"~\u003e 0.1.1\"}\n  ]\nend\n```\n\nDocumentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)\nand published on [HexDocs](https://hexdocs.pm). Once published, the docs can\nbe found at [https://hexdocs.pm/strsim](https://hexdocs.pm/strsim).\n\n[0]: https://elixir-lang.org\n[1]: https://www.rust-lang.org \n[2]: https://crates.io/crates/strsim\n[3]: https://hex.pm/packages/rustler\n[4]: https://hex.pm/packages/fuzzy_compare\n[5]: https://hex.pm/packages/levenshtein\n[6]: https://hexdocs.pm/elixir/String.html#jaro_distance/2\n[7]: https://hex.pm/packages/the_fuzz\n[8]: https://hex.pm/packages/simetric\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoshrotenberg%2Fstrsim_ex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoshrotenberg%2Fstrsim_ex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoshrotenberg%2Fstrsim_ex/lists"}