Exemplo n.º 1
1
print "\n";
print JaroWinkler($target, $candidate);
print "\n";
$target = "Sutonska";
$candidate = "Sotonska";
printf("%s ~ %s\n", $target, $candidate);
print Jaro($target, $candidate);
print "\n";
print JaroWinkler($target, $candidate);
print "\n";
$target = "Ves";
$candidate = "Vel";
printf("%s ~ %s\n", $target, $candidate);
print Jaro($target, $candidate);
print "\n";
print JaroWinkler($target, $candidate);
print "\n";
$target = "Radić";
$candidate = "Tadić";
printf("%s ~ %s\n", $target, $candidate);
print Jaro($target, $candidate);
print "\n";
print JaroWinkler($target, $candidate);
print "\n";
$target = "Međimurska";
$candidate = "Međimurje";
printf("%s ~ %s\n", $target, $candidate);
print Jaro($target, $candidate);
print "\n";
print JaroWinkler($target, $candidate);
print "\n";
function JaroWinkler($string1, $string2, $PREFIXSCALE = 0.1)
{
    $JaroDistance = Jaro($string1, $string2);
    $prefixLength = getPrefixLength($string1, $string2);
    return $JaroDistance + $prefixLength * $PREFIXSCALE * (1.0 - $JaroDistance);
}
Exemplo n.º 3
0
function JaroWinkler($string1, $string2, $toupper = false, $PREFIXSCALE = 0.1)
{
    if ($toupper) {
        $string1 = strtoupper($string1);
        $string2 = strtoupper($string2);
    }
    $JaroDistance = Jaro($string1, $string2);
    $prefixLength = getPrefixLength($string1, $string2);
    return $JaroDistance + $prefixLength * $PREFIXSCALE * (1.0 - $JaroDistance);
}