giacomocavalieri / edit_distance

📝 A pure Gleam package to compute the edit distance of two strings
https://hexdocs.pm/edit_distance/
Apache License 2.0
5 stars 1 forks source link
edit-distance levenshtein-distance

edit_distance

Package Version Hex Docs CI

📝 A pure Gleam package to compute the edit distance of two strings

⚙️ This package supports the Erlang and JavaScript targets!

Installation

To add this package to your Gleam project:

gleam add edit_distance

Usage

To use the package, you can import the module corresponding to one of the metrics and call the distance function. For example, to compute the edit distance of two strings using the Levenshtein distance you can:

import edit_distance/levenshtein
levenshtein.distance("gleam", "beam")
// -> 2

Future plans

For now the only implemented algorithm is the Levenshtein distance, but I'd like to add more: for sure the Damerau-Levenshtein distance would be a useful future addition!

Contributing

If you think there's any way to improve this package, or if you spot a bug don't be afraid to open PRs, issues or requests of any kind! Any contribution is welcome 💜

Aknowledgments

Credits for the Levenshtein distance implementation go to the Levenshtein Elixir library!