Coverage Report - org.galagosearch.core.scoring.LinearWeighting
 
Classes in this File Line Coverage Branch Coverage Complexity
LinearWeighting
0%
0/6
N/A
1
 
 1  
 // BSD License (http://www.galagosearch.org/license)
 2  
 package org.galagosearch.core.scoring;
 3  
 
 4  
 /**
 5  
  *
 6  
  * @author trevor
 7  
  */
 8  
 public class LinearWeighting {
 9  
     double lambda;
 10  
     double background;
 11  
 
 12  
     /** Creates a new instance of LinearWeighting */
 13  0
     public LinearWeighting(double lambda, double background) {
 14  0
         this.lambda = lambda;
 15  0
         this.background = background;
 16  0
     }
 17  
 
 18  
     public double score(int count, int length) {
 19  0
         double foreground = (double) count / (double) length;
 20  0
         return (1 - lambda) * foreground + lambda * background;
 21  
     }
 22  
 }