title: How to compute letter frequency similarity?
body: <p>Given this data (relative letter frequency from both languages):</p>
  
  <pre><code>spanish =&gt; 'e' =&gt; 13.72, 'a' =&gt; 11.72, 'o' =&gt; 8.44, 's' =&gt; 7.20, 'n' =&gt; 6.83,
  english =&gt; 'e' =&gt; 12.60, 't' =&gt; 9.37, 'a' =&gt; 8.34, 'o' =&gt; 7.70, 'n' =&gt; 6.80,
  </code></pre>
  
  <p>And then computing the letter frequency for the string "this is a test" gives me:</p>
  
  <pre><code>"t"=&gt;21.43, "s"=&gt;14.29, "i"=&gt;7.14, "r"=&gt;7.14, "y"=&gt;7.14, "'"=&gt;7.14, "h"=&gt;7.14, "e"=&gt;7.14, "l"=&gt;7.14
  </code></pre>
  
  <p>So, what would be a good approach for matching the given string letter frequency with a language (and try to detect the language)? I've seen (and have tested) some examples using levenshtein distance, and it seems to work fine until you add more languages.</p>
  
  <pre><code>"this is a test" gives (shortest distance:) [:english, 13] ...
  "esto es una prueba" gives (shortest distance:) [:spanish, 13] ...
  </code></pre>