PHP 4.0 Bug #9080: bug in weighted Levenshtein distance function

From: Date: Fri, 02 Feb 2001 17:04:58 +0000
Subject: PHP 4.0 Bug #9080: bug in weighted Levenshtein distance function
Groups: php.dev 
Request: Send a blank email to php-dev+get-45623@lists.php.net to get a copy of this message
From: sb@ldc.upenn.edu Operating system: PHP version: 4.0.4pl1 PHP Bug Type: *Function Specific Bug description: bug in weighted Levenshtein distance function In function: static int weighted_levdist There is a block of code: 118 /* if we already used up one string, then 119 the result is the length of the other */ 120 if(*s1=='\0') return strlen(s2); 121 if(*s2=='\0') return strlen(s1); This is correct for unweighted, but not weighted Levenshtein. The value on line 120 should be multiplied by cost_ins, and the value on line 121 should be multiplied by cost_del. Steven Bird <sb@ldc.upenn.edu> http://www.ldc.upenn.edu/sb/ -- Edit Bug report at: http://bugs.php.net/?id=9080&edit=1

« previous php.dev (#45623) next »