Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Looking at your problem, <a href="http://docs.python.org/2/library/difflib.html#difflib.SequenceMatcher.ratio" rel="nofollow">difflib.SequenceMatcher.ratio()</a> might come handy.</p> <p>This nifty routine, takes two strings and calculates a similarity index in the range [0,1]</p> <h2>Quick Demo</h2> <pre><code>&gt;&gt;&gt; for a,b in list(itertools.product(st, st)): print "Text 1 {}".format(a) print "Text 2 {}".format(b) print "Similarity Index {}".format(difflib.SequenceMatcher(None, a,b).ratio()) print '-'*80 Text 1 One day a man walked over the hill and saw the sun Text 2 One day a man walked over the hill and saw the sun Similarity Index 1.0 -------------------------------------------------------------------------------- Text 1 One day a man walked over the hill and saw the sun Text 2 One week a woman looked over a hill and saw the sun Similarity Index 0.831683168317 -------------------------------------------------------------------------------- Text 1 One day a man walked over the hill and saw the sun Text 2 One day a man walked over a hill and saw the sun Similarity Index 0.959183673469 -------------------------------------------------------------------------------- Text 1 One week a woman looked over a hill and saw the sun Text 2 One day a man walked over the hill and saw the sun Similarity Index 0.831683168317 -------------------------------------------------------------------------------- Text 1 One week a woman looked over a hill and saw the sun Text 2 One week a woman looked over a hill and saw the sun Similarity Index 1.0 -------------------------------------------------------------------------------- Text 1 One week a woman looked over a hill and saw the sun Text 2 One day a man walked over a hill and saw the sun Similarity Index 0.868686868687 -------------------------------------------------------------------------------- Text 1 One day a man walked over a hill and saw the sun Text 2 One day a man walked over the hill and saw the sun Similarity Index 0.959183673469 -------------------------------------------------------------------------------- Text 1 One day a man walked over a hill and saw the sun Text 2 One week a woman looked over a hill and saw the sun Similarity Index 0.868686868687 -------------------------------------------------------------------------------- Text 1 One day a man walked over a hill and saw the sun Text 2 One day a man walked over a hill and saw the sun Similarity Index 1.0 -------------------------------------------------------------------------------- </code></pre>
    singulars
    1. This table or related slice is empty.
    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. 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.
    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