title: How to effectively use the Levenshtein algorithm for text auto-completion
body: <p>I'm using the Levenshtein distance algorithm to filter through some text in order to determine the best matching result for the purpose of text field auto-completion (and top 5 best results).</p>
  
  <p>Currently, I have an array of strings, and apply the algorithm to each one in an attempt to determine how close of a match it is to the text which was typed by the user. The problem is that I'm not too sure how to interpret the values outputted by the algorithm to effectively rank the results as expected.</p>
  
  <p>For example: (Text typed = "<strong>nvmb</strong>")</p>
  
  <ol>
  <li>Result: "<strong>game</strong>" ; levenshtein distance = 3 (best match)</li>
  <li>Result: "<strong>number the stars</strong>" ; levenshtein distance = 13 (second best match)</li>
  </ol>
  
  <p>This technically makes sense; the second result needs many more 'edits', because of it's length. The problem is that the second result is logically and visually a much closer match than the first one. It's almost as if I should ignore any characters longer than the length of the typed text.</p>
  
  <p>Any ideas on how I could achieve this?</p>