sonic-pi

https://github.com/sonic-pi-net/sonic-pi

C++

Code. Music. Live.

Text::Levenshtein#distance

Calculate the Levenshtein distance between two strings +str1+ and +str2+.

The optional argument max_distance can reduce the number of iterations by
stopping if the Levenshtein distance exceeds this value. This increases
performance where it is only necessary to compare the distance with a
reference value instead of calculating the exact distance.

The distance is calculated in terms of Unicode codepoints. Be aware that
this algorithm does not perform normalisation: if there is a possibility
of different normalised forms being used, normalisation should be performed
beforehand.

Source | Google | Stack overflow

Edit

git clone [email protected]:sonic-pi-net/sonic-pi.git

cd sonic-pi

open app/server/ruby/vendor/text-1.3.1/lib/text/levenshtein.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Text--Levenshtein-distance-for-pr


# Commit to git

git add app/server/ruby/vendor/text-1.3.1/lib/text/levenshtein.rbgit commit -m "better docs for Text::Levenshtein#distance"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-Text--Levenshtein-distance-for-pr

hub pull-request


# Celebrate!