private static void SetJaroWinklerParameters(JaroWinklerAlgorithm algorithm) { while (true) { Console.Write("Scaling Factor (from 0 to 1, default = 0.1): "); var input = Console.ReadLine(); if (double.TryParse(input?.Trim(), out var sf) && sf >= 0 && sf <= 1) { algorithm.ScalingFactor = sf; break; } Console.WriteLine("You entered incorrect data. Please, try again."); } while (true) { Console.Write("Threshold for scaling appliance (from 0 to 1, default = 0.7): "); var input = Console.ReadLine(); if (double.TryParse(input?.Trim(), out var t) && t >= 0 && t <= 1) { algorithm.Threshold = t; break; } Console.WriteLine("You entered incorrect data. Please, try again."); } }
public JaroWinklerTests() { var algorithm = new JaroWinklerAlgorithm(); algorithm.ScalingFactor = ScalingFactor; algorithm.Threshold = Threshold; _algorithm = algorithm; }
private static void CheckIfJaroWinklerParametersAreToBeSet(JaroWinklerAlgorithm algorithm) { while (true) { Console.Write("Do you want to customize values for Jaro-Winkler algorithm parameters? (y/n): "); var input = Console.ReadLine()?.Trim() ?? string.Empty; if (input.Equals("y", StringComparison.OrdinalIgnoreCase)) { SetJaroWinklerParameters(algorithm); break; } if (input.Equals("n", StringComparison.OrdinalIgnoreCase)) { break; } Console.WriteLine("You entered incorrect option! Please, try again."); } }