/// <summary> /// The generic test core called by all correctness test methods. It calls the /// <seealso cref="SimilarityBase#score(BasicStats, float, float)"/> method of all /// Similarities in <seealso cref="#sims"/> and compares the score against the manually /// computed {@code gold}. /// </summary> private void CorrectnessTestCore(SimilarityBase sim, float gold) { BasicStats stats = CreateStats(); BasicStats realStats = (BasicStats)sim.ComputeWeight(stats.TotalBoost, ToCollectionStats(stats), ToTermStats(stats)); float score = sim.Score(realStats, FREQ, DOC_LEN); Assert.AreEqual(gold, score, FLOAT_EPSILON, sim.ToString() + " score not correct."); }
public override float Score(int doc, float freq) { // We have to supply something in case norms are omitted return(OuterInstance.Score(Stats, freq, Norms == null ? 1F : OuterInstance.DecodeNormValue((sbyte)Norms.Get(doc)))); }