title: how to implement jaccard coefficient in java?
body: <p>Assume I have 2 strings like this.</p>
  
  <p>Query1: "Ideas of March"</p>
  
  <p>Query2: "Ceaser died in March"</p>
  
  <p>Function(j) = (Query1 intersection Query2)/ (Query1 union Query2)</p>
  
  <p>I am looking at accuracy with respect to number of tokens(words), irrespective their position.</p>
  
  <p>Query1 intersection Query2   = 1 {March}</p>
  
  <p>Query1 union Query2          = 6 {Ideas, of, March,Ceaser, died, in}</p>
  
  <p>In this context Function(j) should return 1/6. </p>
  
  <p>Is there anyway I can find the intersection count and union count of two sentences? For an example, in here, </p>
  
  <pre><code>public double calculateSimilarity(String  oneContent,  String otherContent)
  {
      double numerator   = intersection(oneContent,otherContet);
      double denominator = union(oneContent,otherContet);
  
      return denominator.size() &gt; 0 ? 
      (double)numerator.size()/(double)denominator.size() : 0;
  }
  </code></pre>
  
  <p>Is these any available function in Java to get intersection count and union count without using any external libraries like Google Guava?</p>