Beispiel #1
0
 public static double InverseDocumentFrequency(Term t)
 {
     return Math.Log10(NumberOfDocuments / t.Frequency);
 }
Beispiel #2
0
 public static double GetNormalizedTermFrequencyInDocument(Term term, int docId, double[] maxTermFrequencyInDocument)
 {
     try
     {
         int tf = term.GetTermFrequencyInDocument(docId);
         if (tf != 0)
         {
             return (a + (1 - a) * (term.GetTermFrequencyInDocument(docId) / maxTermFrequencyInDocument[docId - 1]));
         }
         else
         {
             return 0;
         }
     }
     catch
     {
         return 0;
     }
 }