private void Initialize(string text, bool substringsAreSimilar) { _source = text ?? throw new ArgumentNullException(nameof(text)); _threshold = GetThreshold(_source); _editDistance = new EditDistance(text); _substringsAreSimilar = substringsAreSimilar; }
public static int GetEditDistance(string source, string target, int threshold = int.MaxValue) { using (var editDistance = new EditDistance(source)) { return(editDistance.GetEditDistance(target, threshold)); } }
public void Free() { _editDistance?.Dispose(); _source = null; _editDistance = null; _lastAreSimilarResult = default(CacheResult); lock (s_poolGate) { s_pool.Push(this); } }