Eep. The subtraction comes first.

LEN(Str1) - Levenshtein(Str1,Str2)
-------------------------------------------------
LEN(Str1)

The maximum levenshtein distance of a string of length L and another
string of length L is of course L (meaning the strings have nothing in
common, hence the edit distance is the length of the string itself).

If comparing two unequal-length strings, use the length of the longer string.

The above scheme will be horrifically inefficient unless your database
supports function- and expression-based indexes (many do not).
However, i understand it is possible to define new functions in MySQL,
so you could code your own SIMILAR function in MySQL. You can do the
same scheme for any open-source database, actually.


On Tue, Mar 25, 2008 at 5:04 PM, Alec Joseph L. Rivera <[EMAIL PROTECTED]> 
wrote:
> Does the subtraction happens first?
>
>  Thanks :-)
>
>
>  On Tue, 2008-03-25 at 15:44 +0800, Orlando Andico wrote:
>  > Let L = levenshtein distance
>  >
>  > Similarity = LEN(Str1) - L  / LEN(Str1)
>  >
>  > This gives you a metric that's kinda similar to SIMILAR.
>
>  --
>
>
> Alec Joseph Rivera
>  F S 3 Consulting Inc.
>  http://www.fs3.ph
>
> _________________________________________________
>  Philippine Linux Users' Group (PLUG) Mailing List
>  [email protected] (#PLUG @ irc.free.net.ph)
>  Read the Guidelines: http://linux.org.ph/lists
>  Searchable Archives: http://archives.free.net.ph
>



-- 
Orlando Andico
+63.2.976.8659 | +63.920.903.0335

"I have always wished for my computer to be as easy to use as my
telephone; my wish has come true because I can no longer figure
out how to use my telephone."
 -- Bjarne Stroustrup
_________________________________________________
Philippine Linux Users' Group (PLUG) Mailing List
[email protected] (#PLUG @ irc.free.net.ph)
Read the Guidelines: http://linux.org.ph/lists
Searchable Archives: http://archives.free.net.ph

Reply via email to