title: Postgres select rows that have a percentage match, and sort by percentage
body: <p>I have a table of sentences in a postgres database. The table is called <code>sentences</code> and the column that stores the sentence for each row is called <code>sentence</code>.</p>
  
  <p>How can I compare the sentences to a given sentence and return the ones in which, say, 60% of the words (or even better the roots of the words) match and then sort the results by the quality of the match?</p>
  
  <p>Ideally a 90% match would come before 70% match and a 50% match wouldn't show at all.</p>
  
  <p>Ideally it would exclude punctuation as well, but that's not a necessity.</p>