title: compare similarity between sets in python
body: <p>I have two sentences in python, that are represents sets of words the user gives in input as query for an image retrieval software:</p>
  
  <pre><code>sentence1 = "dog is the"
  sentence2 = "the dog is a very nice animal"
  </code></pre>
  
  <p>I have a set of images that have a description, so for example:</p>
  
  <pre><code>sentence3 = "the dog is running in your garden"
  </code></pre>
  
  <p>I want to recover all the images that have a description "very close" to the query inserted by user, but this part related to description should be normalized between 0 and 1 since it is just a part of a more complex research which considers also geotagging and low level features of images.</p>
  
  <p>Given that I create three sets using:</p>
  
  <pre><code>set_sentence1 = set(sentence1.split())
  set_sentence2 = set(sentence2.split())
  set_sentence3 = set(sentence3.split())
  </code></pre>
  
  <p>And compute the intersection between sets as:</p>
  
  <pre><code>intersection1 = set_sentence1.intersection(set_sentence3)
  intersection2 = set_sentence2.intersection(set_sentence3)
  </code></pre>
  
  <p>How can i normalize efficiently the comparison? </p>
  
  <p>I don't want to use levensthein distance, since I'm not interested in string similarity, but in set similarity.</p>