www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Levenshtein Distance algorithm

reply LaggedOnUser <laggedonuser gmail.com> writes:
Hello,

Some time ago, Walter mentioned that it might be possible to contribute code to
Phobos.  He specified three possible ways of doing so, the first option was
public domain.  I have written a simple implementation of the Levenshtein
Distance algorithm for two strings which I am contributing to the public domain
for possible use by Digital Mars or anyone else in case anyone is interested. 
It is attached to this message, along with a few simple tests.  The
implementation should be sound; I also tested it against a file of over 100,000
words and their pronunciations.  The result was in every case identical to the
PHP implementation of Levenshtein function (see http://us2.php.net/levenshtein).

LaggedOnUser
Feb 18 2007
parent BCS <ao pathlink.com> writes:
Reply to LaggedOnUser,

 Hello,
 
 Some time ago, Walter mentioned that it might be possible to
 contribute code to Phobos.  He specified three possible ways of doing
 so, the first option was public domain.  I have written a simple
 implementation of the Levenshtein Distance algorithm for two strings
 which I am contributing to the public domain for possible use by
 Digital Mars or anyone else in case anyone is interested.  It is
 attached to this message, along with a few simple tests.  The
 implementation should be sound; I also tested it against a file of
 over 100,000 words and their pronunciations.  The result was in every
 case identical to the PHP implementation of Levenshtein function (see
 http://us2.php.net/levenshtein).
 
 LaggedOnUser
 
If you would like, I could arange for this to be added to "Scrapple". http://www.dsource.org/projects/scrapple/
Feb 18 2007