Paradox
https://github.com/elixir-lang/elixir/pull/3112
Back in 2015 the String.levenshtein_distance/2 function was removed, and replaced with the String.jaro_distance/2 we have now.
This stackoverflow answer explains the difference between the two algorithims.
My question is, why was levenshtein distance removed, when it has certain use cases that Jaro does not satisfy. To go deeper, why are any of these string comparisons still in STDlib? I do find them immensely useful, but it does seem odd to have them as an incomplete set.
Interesting enough, both the Jaro implementation we have in STDlib right now and the older levenshtein implementation both have “alternates” that aim to improve their ability to differentiate string distance. Jaro has the winkler modification, which gives favorability to strings that share longer prefixes, and levenshtein has the damerau modification, which allows it to recognize transpositions, and the Boehmer & Rees modification, which allows for arbitrary length transpositions.
Trending in Questions
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #hex
- #security










Showing Posts 1 to 1- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
al2o3cr
The last file in the linked PR is the key:
mixusesString.jaro_distanceto suggest alternatives for typo’d commands.The linked StackOverflow answer mentions that Jaro is preferable for short strings, which the average
mixtask name qualifies as.Finally, it’s in stdlib for the same reason that
tsortis in the Ruby stdlib; tooling that either runs the package manager or IS the package manager needs the functionality to exist before packages can be relied on. For instance, runningmix desp.get(typo) on a clean Elixir install needs to be able to reply with: