title: Javascript - Get percentage of similarity between array of multiple strings using levenshtein algorithm
body: <p>I need to get a percentage or score to represent how likely it is that an array of strings are describing the same object. </p>
  
  <p>My attempt at an idea is below, i'm sure there is a better way which is why i'm reaching out here to you smart people.</p>
  
  <pre><code>var levenshtein = require('fast-levenshtein');
  
  var items = [
     'Michael Jordan - NBA - Chicago Bulls',
     'Michael J - Chicago',
     'Michael Jordan - NBA',
     'Michael Jordan - NBA - Chicago',
  ];
  
  function getPercentageOfCertainty(items) {
  
      var firstItem = items[0]
      var totalItems = items.length;
  
      var percentagePoints = items.reduce(function(memo, item) {
  
          var distance = levenshtein.get(item, firstItem, { useCollator: true})
          memo += distance;
  
          return memo;
      }, 0)
  
      return (totalItems * 100) - percentagePoints;
  
  }
  
  
  var percentage = getPercentageOfCertainty(items);
  //0.8, 80% or some other way to score the similarity
  
  </code></pre>
  
  <p>My thoughts are to calculate the similarity of each string to the first string in the set, then either get an average or add all of the scores together and divide by the total amount of items. </p>