Quick actions

cmd+k|ctrl+k

Navigation

Languages

DiceCoefficientExtensions

Snippet info

Language

Csharp

Visibility

public

Author

mumfordnsons

Created

2016-10-27T12:19:10Z

Updated

2016-10-27T13:50:58Z

namespace StringMatching {
    
    using System;
    using System.Collections.Generic;
    
    class MainClass {
        static void Main() {
            
            var acceptedMatchLevel = 0.33;
            
            var users = new Dictionary<string, string> {
                {"Chris Mumford 5 lubnaig drive", "Christopher 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", "Brian Evans 234 Bryant Avenue"}
            };
            
            foreach (var user in users) {
                var matchResult = DiceCoefficientExtensions.DiceCoefficient(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