# PB Name matching Documenting different name matching options ## `String.Equals()` Strip down first/last names from PB and BT and see if they match ### Pros * relatively fast * simple ### Cons * could cause a lot of failures due to shortened names * robert : bob * william : bill * steven : steve ## Levenshtein distance Wiki: https://en.wikipedia.org/wiki/Levenshtein_distance We can utilize this to gain a configurable confidence intervla of a name match. ### Pros * Configurable * Handles fuzzyness well ### Cons * costly expression * even performant libraries have a performance overhead * needs to be configured * Will need to determine an appropriate "confidence interval" ## FuzzySharp https://github.com/JakeBayer/FuzzySharp Generates a "confidence interval" we can use to rate if we think a name matches up. ### Pros * Configurable * we can set the confidence interval in the deployment options * Handles fuzzyness better than pure lavenshtein distance * May not need to remove special characters? ### Cons * Somewhat costly * needs to be configured ### Sample: ``` C# // See https://aka.ms/new-console-template for more information using System.Diagnostics; using FuzzySharp; Console.WriteLine("Hello, World!"); var testList = new (string,string)[]{ ("robert stephenson", "bob stephenson"), ("mysmilarstring", "myawfullysimilarstirng"), ("Christopher Decker", "Chris Decker"), ("Steve McAleer", "Steven Mcaleer"), ("Matthew Roebuck", "Matt Roebuck") }; var stopWatch = new Stopwatch(); foreach (var (name1, name2) in testList) { stopWatch.Restart(); var score = Fuzz.WeightedRatio(name1, name2).ToString(); stopWatch.Stop(); Console.WriteLine($"Comparing '{name1}' : '{name2}' scored {score} and took {stopWatch.ElapsedMilliseconds.ToString()}ms"); } /* * Comparing 'robert stephenson' : 'bob stephenson' scored 84 and took 81ms * Comparing 'mysmilarstring' : 'myawfullysimilarstirng' scored 77 and took 10ms * Comparing 'Christopher Decker' : 'Chris Decker' scored 80 and took 0ms * Comparing 'Steve McAleer' : 'Steven Mcaleer' scored 89 and took 0ms * Comparing 'Matthew Roebuck' : 'Matt Roebuck' scored 89 and took 0ms */ ``` # Implementation ## Deposits Implementations would be gateway specific as not all gateways provide account name information. Cost is relatively cheap, could be done as part of the pre-orchestration validation. ## Withdrawals Could be completed as part of the pre-assessment validation Additional field for consideration during assessment (both via admin and WAE) # Summary Fuzzy ratio is an additional piece of metadata we can use to help with deposit/withdrawal assessment.