Article Preview
Buy Now
| Print: | |
| PDF: |
Feature
Levenshtein Distance
Calculating the degree of difference between two strings
Issue: 3.6 (July/August 2005)
Author: Thomas Reed
Author Bio: Thomas Reed has been programming as a hobbyist for more than 20 years, and fell in love with the Mac in 1984.
Article Description: No description available.
Article Length (in bytes): 7,274
Starting Page Number: 36
RBD Number: 3617
Resource File(s):
3617.sit Updated: Monday, July 25, 2005 at 11:27 AM
Related Link(s): None
Known Limitations: None
Excerpt of article text...
Imagine that you are creating a spell checker for your application. At first glance, everything seems pretty straightforward. Later, you happen to be searching Google for recipes for grilled halibut, only you mistype it "halivut". Up pops a nice little message at the top of the results window reading "Did you mean halibut?" Hey, that would be a nice feature to integrate into your spell checker! "But wait!" you say, "How do I do that?"
The solution to this problem involves calculating what is often called the string or edit distance. In other words, you need to know the degree of difference between two strings. One popular algorithm for evaluating this difference is the Levenshtein Distance algorithm.
The Levenshtein Distance is not only useful for spell checkers, but has many other applications. For example, suppose you are designing a database and want to guard against duplicate entries. It would be useful to be able to display a warning when entering a record for "Smith, Martin" when the database already contains an entry for "Smith, Marty".
...End of Excerpt. Please purchase the magazine to read the full article.
Article copyrighted by REALbasic Developer magazine. All rights reserved.
|








