title: How to efficiently find similar strings in a unique string in JavaScript?
body: <p>Background: I have a list that contains 13,000 records of human names, some of them are duplicates and I want to find out the similar ones to do the manual duplication process.</p>
  
  <p>For an array like: </p>
  
  <pre><code>["jeff","Jeff","mandy","king","queen"] 
  </code></pre>
  
  <p>What would be an efficient way to get: </p>
  
  <pre><code>[["jeff","Jeff"]]
  </code></pre>
  
  <p><strong>Explanation</strong> <code>["jeff","Jeff"]</code> since their Levenshtein distance is 1(which can be variable like 3).</p>
  
  <pre><code>/* 
  Working but a slow solution
  */
  function extractSimilarNames(uniqueNames) {
    let similarNamesGroup = [];
  
    for (let i = 0; i &lt; uniqueNames.length; i++) {
      //compare with the rest of the array
      const currentName = uniqueNames[i];
  
      let suspiciousNames = [];
  
      for (let j = i + 1; j &lt; uniqueNames.length; j++) {
        const matchingName = uniqueNames[j];
        if (isInLevenshteinRange(currentName, matchingName, 1)) {
          suspiciousNames.push(matchingName);
          removeElementFromArray(uniqueNames, matchingName);
          removeElementFromArray(uniqueNames, currentName);
          i--;
          j--;
        }
      }
      if (suspiciousNames.length &gt; 0) {
        suspiciousNames.push(currentName);
      }
    }
    return similarNamesGroup;
  }
  </code></pre>
  
  <p>I want to find the similarity via Levenshtein distance, not only the lower/uppercase similarity</p>
  
  <p>I already find one of the  <a href="https://github.com/yomguithereal/talisman#readme" rel="nofollow noreferrer">fastest Levenshtein implementation</a> but it still takes me to 35 mins to get the result of 13000 items list.</p>