title: Alternative to Levenshtein and Trigram
body: <p>Say I have the following two strings in my database:</p>
  
  <pre><code>(1) 'Levi Watkins Learning Center - Alabama State University'
  (2) 'ETH Library'
  </code></pre>
  
  <p>My software receives free text inputs from a data source, and it should match those free texts to the pre-defined strings in the database (the ones above).</p>
  
  <p>For example, if the software gets the string <strong><code>'Alabama University'</code></strong>, it should recognize that this is more similar to <code>(1)</code> than it is to <code>(2)</code>.</p>
  
  <p>At first, I thought of using a well-known <strong>string metric</strong> like Levenshtein-Damerau or Trigrams, but this leads to unwanted results as you can see here:</p>
  
  <p><a href="http://fuzzy-string.com/Compare/Transform.aspx?r=Levi+Watkins+Learning+Center+-+Alabama+State+University&amp;q=Alabama+University" rel="noreferrer">http://fuzzy-string.com/Compare/Transform.aspx?r=Levi+Watkins+Learning+Center+-+Alabama+State+University&amp;q=Alabama+University</a></p>
  
  <p><a href="http://fuzzy-string.com/Compare/Transform.aspx?r=ETH+Library&amp;q=Alabama+University" rel="noreferrer">http://fuzzy-string.com/Compare/Transform.aspx?r=ETH+Library&amp;q=Alabama+University</a></p>
  
  <pre><code>Difference to (1): 37
  Difference to (2): 14
  </code></pre>
  
  <p><code>(2)</code> wins because it is much shorter than <code>(1)</code>, even though <code>(1)</code> contains both words (<code>Alabama</code> and <code>University</code>) of the search string.</p>
  
  <p>I also tried it with Trigrams (using the Javascript library fuzzySet), but I got similar results there.</p>
  
  <p><strong>Is there a string metric that would recognize the similarity of the search string to <code>(1)</code>?</strong></p>