Quick actions

cmd+k|ctrl+k

Navigation

Languages

JaroWinklerDistance

Snippet info

Language

Csharp

Visibility

public

Author

mumfordnsons

Created

2016-10-27T12:18:58Z

Updated

2016-10-27T13:50:49Z

namespace StringMatching {
    
    using System;
    using System.Collections.Generic;
    
    class MainClass {
        static void Main() {
            
            var acceptedMatchLevel = 0.8;
            
            var users = new Dictionary<string, string> {
                {"Chris Mumford 5 lubnaig drive", "Christopher David Mumford 5 lubnaig dr"},
                {"Ken A.Z 2354 Alexandria Road", "K Aue Zen Alexandria Rd"},
                {"J D 234 Bryant Avenue, pa8 e4w Scotland uk", "Jonathon Davis 234 Bryant av"},
                {"J D 234 Bryant Avenue pa8 e4w Scotland uk", "Jonathon Davis 234 Bryant Avenue"},
                {"Jerry Springer 232 Bryant Avenue pa8 e4w Scotland uk", "Jonathon Davis 234 Bryant Avenue"}
            };
            
            foreach (var user in users) {
                var matchResult = JaroWinklerDistance.proximity(Cleanser.Cleanse(user.Key), Cleanser.Cleanse(user.Value));    
                Console.WriteLine("===========================");
                Console.WriteLine($"{user.Key} ------- {user.Value}");
                Console.WriteLine(matchResult >= acceptedMatchLevel ? "Matched" : "Not matched");
                Console.WriteLine(matchResult);
            }
        }
    }
    
}
INFO