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