Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Levenshtein distance will not completely work, because you want to allow rearrangements. I think your best bet is going to be to find best rearrangement with levenstein distance as cost for each word.</p> <p>To find the cost of rearrangement, kinda like the <a href="http://mathworld.wolfram.com/PancakeSorting.html" rel="noreferrer">pancake sorting problem</a>. So, you can permute every combination of words (filtering out exact matches), with every combination of other string, trying to minimize a combination of permute distance and Levenshtein distance on each word pair.</p> <p><em>edit:</em> Now that I have a second I can post a quick example (all 'best' guesses are on inspection and not actually running the algorithms):</p> <pre><code>original strings | best rearrangement w/ lev distance per word Into the clear blue sky | Into the c_lear blue sky The color is sky blue | is__ the colo_r blue sky R_dist = dist( 3 1 2 5 4 ) --&gt; 3 1 2 *4 5* --&gt; *2 1 3* 4 5 --&gt; *1 2* 3 4 5 = 3 L_dist = (2D+S) + (I+D+S) (Total Subsitutions: 2, deletions: 3, insertion: 1) </code></pre> <p>(notice all the flips include all elements in the range, and I use ranges where Xi - Xj = +/- 1) </p> <p>Other example</p> <pre><code>original strings | best rearrangement w/ lev distance per word Into the clear blue sky | Into the clear blue sky In the blue clear sky | In__ the clear blue sky R_dist = dist( 1 2 4 3 5 ) --&gt; 1 2 *3 4* 5 = 1 L_dist = (2D) (Total Subsitutions: 0, deletions: 2, insertion: 0) </code></pre> <p>And to show all possible combinations of the three...</p> <pre><code>The color is sky blue | The colo_r is sky blue In the blue clear sky | the c_lear in sky blue R_dist = dist( 2 4 1 3 5 ) --&gt; *2 3 1 4* 5 --&gt; *1 3 2* 4 5 --&gt; 1 *2 3* 4 5 = 3 L_dist = (D+I+S) + (S) (Total Subsitutions: 2, deletions: 1, insertion: 1) </code></pre> <p>Anyway you make the cost function the second choice will be lowest cost, which is what you expected!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload