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