Important alert: (current site time 7/15/2013 5:56:38 PM EDT)
 

winzip icon

[ A C++ implementation of the Levenshtein Distance ]

Email
Submitted on: 1/17/2005 2:26:14 AM
By: Gonzales Cenelia  
Level: Advanced
User Rating: By 5 Users
Compatibility: C++ (general)
Views: 18276
author picture
(About the author)
 
     The "Levenshtein distance" is a measure of the similarity between two strings, this algorithm is also refered to as "edit distance". The "Levenshtein distance" was named after the russian scientist "Vladimir Levenshtein", who has discovered it back in 1965. The smaller the distance between two strings, the closer are those strings syntacticaly. The "Levenshtein distance" distance is computed by calculating the minimum number of operations that has to be made to transform one string to another one,usualy this operations are: replace,insert or delete a character example: we can change the word: "mathematics" to "mathematician" by changing one character and by inserting two more characters at the end.(we can replace "s" by "i" and also insert "a" and "n" after that). The total number of operations that was needed in this case to change "mathematics" to "mathematician" was 3 operations and since it is also the smallest number of operation that can be use transform one of these strings to the other one, that value is also a measure of the "Levenshtein distance" between these two strings. There has been many application of the "Levenshtein distance", here is a few of them: Spell Checking, Speech Recognition, Pattern Recognition etc.
 

INCLUDE files:

Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
//**************************************
//INCLUDE files for :[ A C++ implementation of the Levenshtein Distance ]
//**************************************
#include <iostream>
#include <string>
#include "distance.h"
using std::string;
using std::cout;
using std::endl;
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 49 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Advanced category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

1/18/2005 4:57:51 AMJared Bruni

Cool good implementation 5 globes =)
(If this comment was disrespectful, please report it.)

 
1/18/2005 11:51:50 AMGonzales Cenelia

thanks Jared!
(If this comment was disrespectful, please report it.)

 
1/26/2005 3:21:30 PMGonzales Cenelia

Please feel free to vote or to live some comments,it will be very appreciated!
(If this comment was disrespectful, please report it.)

 
9/12/2007 3:47:20 AMyes!

This website is so cool,As a student of Computer Programming I can use this for the development of good projects,Thank you!
(If this comment was disrespectful, please report it.)

 
12/6/2008 1:55:03 AMKhalilo

Thnx man ..
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.