An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

[![Ruby](https://github.com/delonnewman/mini-levenshtein/actions/workflows/ruby.yml/badge.svg)](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).