@Override public double score(Posting p) { double score = 0; for(WeightingModel w : parents) { score += w.score(p); } return score; }
@Override public double score(double tf, double docLength) { double score = 0; for(WeightingModel w : parents) { score += w.score(tf, docLength); } return score; } }
@Override public double score(Posting p) { double score = 0; for(WeightingModel w : parents) { score += w.score(p); } return score; }
@Override public double score(double tf, double docLength) { double score = 0; for(WeightingModel w : parents) { score += w.score(tf, docLength); } return score; } }
/** Returns the score using all weighting models for the current posting of the * specified term * @param i Which term to score * @return score obtained from all weighting models for that term */ public double score(int i) { assert i>=0 && i < numTerms: "Looking for posting list " + i + " out of " + (numTerms) + " posting lists."; assert termPostings.get(i).getId() != IterablePosting.EOL : "Term " + i + ", posting list at EOL"; double score = 0.0d; score = termModels.get(i).score(termPostings.get(i)); //System.err.println("For term " + i + " scoring " // + termPostings.get(i).getId() + "; got score " + score); return score; }
/** Returns the score using all weighting models for the current posting of the * specified term * @param i Which term to score * @return score obtained from all weighting models for that term */ public double score(int i) { assert i>=0 && i < numTerms: "Looking for posting list " + i + " out of " + (numTerms) + " posting lists."; assert termPostings.get(i).getId() != IterablePosting.EOL : "Term " + i + ", posting list at EOL"; double score = 0.0d; score = termModels.get(i).score(termPostings.get(i)); //System.err.println("For term " + i + " scoring " // + termPostings.get(i).getId() + "; got score " + score); return score; }
/** * Returns score * @param p * @return score */ public double score(Posting p) { return this.score(p.getFrequency(), p.getDocumentLength()); }
/** * Returns score * @param p * @return score */ public double score(Posting p) { return this.score(p.getFrequency(), p.getDocumentLength()); }
@Override public double score(Posting _p) { FieldPosting p = (FieldPosting)_p; final int[] tff = p.getFieldFrequencies(); final int[] lf = p.getFieldLengths(); //System.err.println("tff=" + ArrayUtils.join(tff, ",")); //System.err.println("lf=" + ArrayUtils.join(lf, ",")); assert lf != null : "No fields lengths from posting "; assert tff.length == lf.length : "Mismatch between lengths of field length and frequencies"; int tf = 0, l = 0; for(int fieldId : activeFieldIds) { tf += tff[fieldId]; l += lf[fieldId]; } if (tf == 0) return 0; assert l > 0 : "Frequency but no length for docid " + p.getId(); //System.err.println("tf=" + tf + " l="+l); final double rtr = basicModel.score(tf, l); if (Double.isNaN(rtr)) System.err.println("BPosting " + p.getId() + " had NaN : tf=" + tf + " l="+l+ " tf=" + org.terrier.utility.ArrayUtils.join(tff, ",") + " lf=" + org.terrier.utility.ArrayUtils.join(lf, ",")); return rtr; }
@Override public double score(Posting _p) { FieldPosting p = (FieldPosting)_p; final int[] tff = p.getFieldFrequencies(); final int[] lf = p.getFieldLengths(); //System.err.println("tff=" + ArrayUtils.join(tff, ",")); //System.err.println("lf=" + ArrayUtils.join(lf, ",")); assert lf != null : "No fields lengths from posting "; assert tff.length == lf.length : "Mismatch between lengths of field length and frequencies"; int tf = 0, l = 0; for(int fieldId : activeFieldIds) { tf += tff[fieldId]; l += lf[fieldId]; } if (tf == 0) return 0; assert l > 0 : "Frequency but no length for docid " + p.getId(); //System.err.println("tf=" + tf + " l="+l); final double rtr = basicModel.score(tf, l); if (Double.isNaN(rtr)) System.err.println("BPosting " + p.getId() + " had NaN : tf=" + tf + " l="+l+ " tf=" + org.terrier.utility.ArrayUtils.join(tff, ",") + " lf=" + org.terrier.utility.ArrayUtils.join(lf, ",")); return rtr; }
assert postings[di][ti].getFrequency() > 0; final WritablePosting p = postings[di][ti]; final double s = wms[ti].score(p);
assert postings[di][ti].getFrequency() > 0; final WritablePosting p = postings[di][ti]; final double s = wms[ti].score(p);
wmodel.setKeyFrequency(1); wmodel.prepare(); double score = wmodel.score(pair.getRight()); assertTrue(Double.isFinite(score)); assertTrue(score > 0d);
((FieldPosting)p).setFieldLengths(new int[4]); scores[di] = wm.score(p);
((FieldPosting)p).setFieldLengths(new int[4]); scores[di] = wm.score(p);