Jaro Distance

function jaro_distance(s1::String, s2::String)::Float64
    s1 == s2 && return 1.0f0
    (m, n) = length(s1), length(s2)
    (m == zero(Int) || n == zero(Int)) && return 0.0f0
    
    maxdist = div(max(m, n), 2) - 1
    match = 0
    hash_s1 = zeros(Int, m, 1)
    hash_s2 = zeros(Int, n, 1)
    
    for i in 1:m
        for j in max(1, i - maxdist):min(n, i + maxdist + 1)
            if s1[i] == s2[j] && hash_s2[j] == 0
                hash_s1[i] = hash_s2[j] = one(Int)
                match += 1
                break
            end
        end
    end
    
    match == 0 && return 0.0f0
    
    t = zero(Int);
    point = one(Int);
    
    for i in 1:m
        if hash_s1[i] > 0
            while hash_s2[point] == 0
                point += 1
            end
            if s1[i] != s2[point]
                point += 1
                t += 1
            else
                point += 1
            end
        end
        t /= 2
    end
    
    return ((match/m + match/n + (match-t)/match) / 3.0)
end

Jaro-Winkler

function jaro_winkler(s1::String, s2::String)
    jaro_dist = jaro_distance(s1, s2)
    
    if (jaro_dist > 0.7)
        prefix = 0;
        for i in 1:min(length(s1), length(s2))
            if s1[i] == s2[i]
                prefix += 1
            else
                break
            end
        end
        prefix = min(4, prefix)
        jaro_dist += 0.1 * prefix * (1 - jaro_dist)
    end
    return jaro_dist
end