Skip to content

Compute the Levenshtein distance between two strings

License

Notifications You must be signed in to change notification settings

elliotekj/leven

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Leven

Welcome to Leven, an efficient, tabulated implementation of the Levenshtein distance algorithm in Elixir. The Levenshtein distance, also known as edit distance, measures the difference between two strings in terms of the minimum number of single-character edits (insertions, deletions, or substitutions) required to change one string into the other.

Hex.pm Version Hex Docs Hex.pm License

Installation

The package can be installed by adding leven to your list of dependencies in mix.exs:

def deps do
  [
    {:leven, "~> 1.0"}
  ]
end

Example

iex(1)> Leven.distance("house", "horses")
2

Two single-character edits are required to get from "house" to "horses":

  1. Substitute "u" for "r", resulting in "horse"
  2. Appens "s", resulting in "horses"

Benchmarks

To benchmark Leven on your machine, clone the repo and run mix bench.

License

Leven is released under the Apache License 2.0.

About

This package was written by Elliot Jackson.

About

Compute the Levenshtein distance between two strings

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages