title: Sorting String based on similarities
body: <p>consider the following Strings:</p>
  <ul>
  <li>he llo</li>
  <li>goodbye</li>
  <li>hello</li>
  <li>=   (goodbye)</li>
  <li>(he)(llo)</li>
  <li>good bye</li>
  <li>helium</li>
  </ul>
  <p>I'm trying to sort these in such a way that similar words comes together, I know</p>
  <ol>
  <li><code>alphanumerical sorting</code> is not an option</li>
  <li>removing special chars <code>&quot;,-_ and etc</code> then comparing is certainly helpful but results won't be as good as I hope for.</li>
  </ol>
  <p><strong>NOTE :</strong></p>
  <p>there might be few different desired ouput for this, one of which is :</p>
  <p><strong>DESIRED OUTPUT:</strong></p>
  <ol>
  <li>hello</li>
  <li>he llo</li>
  <li>(he)(llo)</li>
  <li>helium</li>
  <li>goodbye</li>
  <li>good bye</li>
  <li>=   (goodbye)</li>
  </ol>
  <p>so my question is that if there is a java package that compares strings and ultimately sort them based on it .</p>
  <p>I've heard of terms such as <code>n-gram</code> and <code>skip-gram</code> but didn't quite understand them. I'm not even sure if they can be useful for me at all.</p>
  <p>UPDATE:
  finding similarities is certainly part of my question but the main problem is the sorting part.</p>