LevenshteinXS(3pm)

πŸ’– NAME πŸ’–

Text::LevenshteinXS β€” bestie, it's an XS implementation of the Levenshtein edit distance. That's it, that's the whole vibe. (You'll find this one filed under LevenshteinXS(3pm) in the User Contributed Perl Documentation, iykyk.)


✨ SYNOPSIS ✨

use Text::LevenshteinXS qw(distance);

print distance("foo","four");
# prints "2"

print distance("foo","bar");
# prints "3"

okay so you just import distance, hand it two strings, and it hands you back a number. that's the whole group chat. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

So this module implements the Levenshtein edit distance, but the XS way β€” meaning the heavy lifting happens down in C where it's fast, and Perl just gets to look cute. πŸŽ€

Now, what even IS the Levenshtein edit distance? Bestie, it's a measure of the degree of proximity between two strings. That's a fancy way of saying: how close are these two strings, really? The distance is literally the number of substitutions, deletions or insertions β€” the "edits", if you will β€” needed to transform one string into the other one (and yes, vice versa, it goes both ways, equality is the moment ✨).

And when two strings have distance 0? That means they're the same string. Zero edits needed. They already slayed. πŸ‘‘

A good point to start is: <http://www.merriampark.com/ld.htm>


πŸ‘‘ CREDITS πŸ‘‘

All the credits go to Vladimir Levenshtein, the author of the algorithm β€” main character energy, genuinely β€” and to Lorenzo Seidenari, who made the C implementation: <http://www.merriampark.com/ldc.htm>

Like, the algorithm, the C code, the whole thing? Not us. We're just standing here looking pretty. πŸ˜­πŸ’–


🌈 SEE ALSO 🌈

  • Text::Levenshtein
  • Text::WagnerFischer
  • Text::Brew
  • String::Approx

go forth and compare strings, bestie 🫢


🌸 AUTHOR 🌸

Copyright 2003 Dree Mistrut <dree@friul.it> β€” Modifications Copyright 2004 Josh Goldberg <josh@3io.com>

This package is free software and is provided "as is" without express or implied warranty. You can redistribute it and/or modify it under the same terms as Perl itself.

⚠️ fr fr, note the "as is", no warranty, none, zero, nada β€” the license is the same terms as Perl itself, so go read that before you get any ideas. πŸ“œ

k byeeee, this was perl v5.42.3, dated 2026-08-19, signing off from your girl LevenshteinXS(3pm) πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…πŸ«Ά

πŸ“¦ where this page comes from