https://github.com/delonnewman/mini-levenshtein
Simple, fast Levenshtein distance and similarity ratio for Ruby
https://github.com/delonnewman/mini-levenshtein
algorithms comparison fuzzy-matching levenshtein-distance natural-language-processing nlp ruby ruby-extension string-matching text
Last synced: about 2 months ago
JSON representation
Simple, fast Levenshtein distance and similarity ratio for Ruby
- Host: GitHub
- URL: https://github.com/delonnewman/mini-levenshtein
- Owner: delonnewman
- License: gpl-2.0
- Created: 2022-04-29T18:20:12.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-12-08T05:51:37.000Z (almost 2 years ago)
- Last Synced: 2025-10-01T15:34:39.729Z (2 months ago)
- Topics: algorithms, comparison, fuzzy-matching, levenshtein-distance, natural-language-processing, nlp, ruby, ruby-extension, string-matching, text
- Language: C
- Homepage:
- Size: 57.6 KB
- Stars: 29
- Watchers: 2
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://github.com/delonnewman/mini-levenshtein/actions/workflows/ruby.yml)
# MiniLevenshtein
Simple, fast, levenshtein distance and similarity ratio for Ruby
# Synopsis
```ruby
MiniLevenshtein.edit_distance("levenshtein", "levenstien") # => 3
MiniLevenshtein.similarity("levenshtein", "levenstien") # 0.857142...
```
# Why?
While there are many levenshtein distance implementations for Ruby, none provided a means to adjust edit scoring to make the calcuations suitable for a similarity ratio.
# See Also
- [python-levenshtein](https://github.com/ztane/python-Levenshtein)
- [Various Ruby Implementations](https://rubygems.org/search?query=levenshtein)
- https://en.wikipedia.org/wiki/Levenshtein_distance
# Credits
## Ruby Bindings
Delon Newman
## Original C Code
- David Necas (Yeti)
- Atakan Gurkan
- James Theiler
- Brian Gough
(see [ext/mini_levenshtein/levenshtein.c](https://github.com/delonnewman/mini-levenshtein/blob/master/ext/mini_levenshtein/levenshtein.c) for more)
# License
The gem is available as open source under the terms of the [GPL](https://opensource.org/licenses/GPL-2.0).