Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/giacomocavalieri/edit_distance
π A pure Gleam package to compute the edit distance of two strings
https://github.com/giacomocavalieri/edit_distance
edit-distance levenshtein-distance
Last synced: about 2 months ago
JSON representation
π A pure Gleam package to compute the edit distance of two strings
- Host: GitHub
- URL: https://github.com/giacomocavalieri/edit_distance
- Owner: giacomocavalieri
- License: apache-2.0
- Created: 2023-07-23T16:07:01.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-10T22:15:55.000Z (10 months ago)
- Last Synced: 2024-09-30T01:36:26.335Z (2 months ago)
- Topics: edit-distance, levenshtein-distance
- Language: Gleam
- Homepage: https://hexdocs.pm/edit_distance/
- Size: 25.4 KB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-gleam - edit_distance - [π](https://hexdocs.pm/edit_distance/) - A pure Gleam package to compute the edit distance of two strings (Packages / Text)
README
# edit_distance
[![Package Version](https://img.shields.io/hexpm/v/edit_distance)](https://hex.pm/packages/edit_distance)
[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/edit_distance/)
![CI](https://github.com/giacomocavalieri/edit_distance/workflows/CI/badge.svg?branch=main)π A pure Gleam package to compute the [edit distance](https://en.wikipedia.org/wiki/Edit_distance) of two strings
> βοΈ This package supports the Erlang and JavaScript targets!
## Installation
To add this package to your Gleam project:
```sh
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:
```gleam
import edit_distance/levenshtein
levenshtein.distance("gleam", "beam")
// -> 2
```## Future plans
For now the only implemented algorithm is the [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance), but I'd like to add more: for sure the [Damerau-Levenshtein distance](https://en.wikipedia.org/wiki/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](https://github.com/preciz/levenshtein) Elixir library!