counting the distance between query and document
<p>i need to calculate the distance between query and document. But i do not know how to calculate it because i do not understand the formula.</p>

<p>I have the term frequency and inverse term frequency for each of the document. Now i need to calculate the distance between the query and the document. </p>

<p>I have search for information but i do not understand how to implement it in java. </p>

<blockquote>
  <p>Formula :</p>
  
  <p>Term frequency = (number of query in
  one document)/(total number of words
  in one document)</p>
  
  <p>Inverse term frequency = log(total
  available documents / number of
  documents containing the query)</p>
  
  <p>TF/IDF = term frequency * inverse term
  frequency</p>
</blockquote>

<p>Lets say i input the query : 'How are you'</p>

<p>My program print output : </p>

<p>how are you</p>

<p>how --> This number of files that contain this term  0</p>

<p>are --> This number of files that contain this term  3</p>

<p>you --> This number of files that contain this term  6</p>

<hr>

<p>The word inputted : how are you</p>

<hr>

<p>| File = abc0.txt |<br>
how --> Word count =     |0|  Total count =      |150|  Term Frequency =  |   0.0000 |  </p>

<pre><code>--&gt; IDF = Infinity

--&gt; TF/IDF = NaN
</code></pre>

<p>are --> Word count =     |0|  Total count =      |150|  Term Frequency =  |   0.0000 |  </p>

<pre><code>--&gt; IDF = 0.5642714398516419

--&gt; TF/IDF = 0.0
</code></pre>

<p>you --> Word count =     |3|  Total count =      |150|  Term Frequency =  |   0.0200 |</p>

<pre><code>--&gt; IDF = 0.2632414441876607

--&gt; TF/IDF = 0.005264828883753215
</code></pre>

<p>How do i calculate the distance between query and the documents ? Any idea ? 
I have found certain resources but i do not understand the formula. Can someone guide me?</p>

<p>Link = <a href="http://www.mnogosearch.org/doc33/msearch-rel.html" rel="nofollow">http://www.mnogosearch.org/doc33/msearch-rel.html</a></p>
