protected static double InverseStringDistance(string a, string b)
        {
            StringDistance dist         = new StringDistance();
            double         realDistance = dist.Distance(a, b);

            return(realDistance == 0 ? double.MaxValue : 1 / realDistance);
        }
Example #2
0
 public void Repeated_Return_Correct_Distances()
 {
     foreach (var test in TestData)
     {
         var results = StringDistance.Distance(test.Word, test.CorrectedWord);
         Assert.AreEqual(test.Distance, results.Distance);
     }
 }
Example #3
0
        static void Main(string[] args)
        {
            string originalWord  = "polite";
            string correctedWord = "p0l1t3";

            var results = StringDistance.Distance(originalWord, correctedWord);

            foreach (var mistake in results.Mistakes)
            {
                Console.WriteLine(mistake.ToString());
            }
            Console.WriteLine($"Total distance: {results.Distance}");
            Console.ReadKey();
        }