------=_Part_124535_13673756.1160993748920
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hi list.

I read an article posted at Wikipedia about Levenshtein distance (aka edit
distance).
The location of the document is
http://en.wikipedia.org/wiki/Levenshtein_distance

In the document, a sample Ruby code goes like the following:

 class String
   def levenshtein(comparator)
     a, b = self.unpack('U*'), comparator.unpack('U*')
     n, m = a.length, b.length
     a, b, n, m = b, a, m, n if n > m
     current = [*0..n]
     1.upto(m) do |i|
       previous, current = current, [i]+[0]*n
       1.upto(n) do |j|
         add, delete = previous[j]+1, current[j-1]+1
         change = previous[j-1]
         change += 1 if a[j-1] != b[i-1]
         current[j] = [add, delete, change].min
       end
     end
     current[n]
   end
 end

In the code, there's a parameter called comparator which seems to be used to
decode given parameter. But, I can't understand what exactly the comparator
is doing.

Does anybody know the detail?

Sincerely,
Minkoo Seo

------=_Part_124535_13673756.1160993748920--