title: Should I use StringMetric or MultisetMetric for comparing these Strings with simmetric
body: <p>I've been using the [Simmetrics][1] Java library with good success for comparing two Strings with good success. But there seem to be two approaches and I need a combination of both for my scenario.</p>
  
  <p>Currently I am using CosineSimilarity (I do use some simplifiers but have omitted here to keep code simple)</p>
  
  <pre><code>StringMetric metric = with(new CosineSimilarity&lt;String&gt;())
                  .tokenize(Tokenizers.whitespace()).build();
   score = metric.compare(string1, string2);
  </code></pre>
  
  <p>and this works quite well except I when there is a simple misspelling I would have expected a higher score than I get</p>
  
  <p>e.g comparing <em>mony honey</em> and <em>money honey</em> only returns <strong>0.5</strong> (scores go from 0.0 to 1.0 with 1.0 being perfect match), I would have expected higher.</p>
  
  <p>With Levenshtein it returns a better <strong>0.9090909</strong></p>
  
  <p>But one thing I noted reading the documentation was that this is a <em>MultiSet</em> metric, and that the whitespace() is actually required to break the input into parts, whereas a <em>StringMetric</em> such as <em>Levenshtein</em> does not</p>
  
  <pre><code> StringMetric metric = with(new Levenshtein())
                  .build();
  </code></pre>
  
  <p>This then implies do me that Levenshtein doesnt consider whitespace specially which is an issue as I want to match words and essentially ignore the whitespace or order.</p>
  
  <p>so for example using CosineSimilarity it returns 1.0 when comparing <em>honey trap</em> and <em>trap honey</em> but Levenshtein return 0.0, that is no good for me.</p>
  
  <p>What I ideally want is word order to not be important, and then for individual words to be a good match if there are just slight variations in the word e.g money/mony</p>
  
  <p>The Strings can be in any language, but are most usually in English, they are song titles so are usually less than ten words long, typically about 5 words long. </p>
  
  <p>Does Simmetrics offer another algorithm that can provide both these parts ?</p>
  
  <p>There are simplifiers such as <em>RefinedSoundex</em> that could be applied to input, but because the language may not be in English dont think that would work very well.</p>
  
  <p>What do you think would be the best algorithm to use ?</p>