Languages
[Edit]
EN

TypeScript - calculate Levenshtein distance between strings

0 points
Created by:
Vanessa-Drake
718

In this short article, we would like to show simple TypeScript implementation for the Levenstein distance algorithm.

Levenstein distance algorithm is used to measure the difference between two sequences (e.g. between two strings).

When the algorithm returns 0 it means: compared objects are equal.

Quick solution:

 

Alternative solution

Edit

In this section, you can find some solution that is at the beginning of this article but with more clear variable names.

 

Levenstein distance algorithm with case-insensitive

Edit

It is necessary to wrap the existing algorithm with toLowerCase() or toUpperCase() string transformation.

References

Edit
  1. Levenshtein distance - Wikipedia
1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join