@@ -0,0 +1,1872 @@
+package org.lemurproject.galago.contrib.retrieval.iterator;%0A%0Aimport org.lemurproject.galago.core.retrieval.RequiredParameters;%0Aimport org.lemurproject.galago.core.retrieval.RequiredStatistics;%0Aimport org.lemurproject.galago.core.retrieval.iterator.CountIterator;%0Aimport org.lemurproject.galago.core.retrieval.iterator.LengthsIterator;%0Aimport org.lemurproject.galago.core.retrieval.iterator.ScoringFunctionIterator;%0Aimport org.lemurproject.galago.core.retrieval.processing.ScoringContext;%0Aimport org.lemurproject.galago.core.retrieval.query.NodeParameters;%0A%0Aimport java.io.IOException;%0A%0A/**%0A * Created by hzhao on 5/22/15.%0A */%0A%0A@RequiredStatistics(statistics = %7B%22collectionLength%22, %22nodeFrequency%22, %22maximumCount%22%7D)%0A@RequiredParameters(parameters = %7B%22mu%22%7D)%0Apublic class DirichletRawScroingIterator extends ScoringFunctionIterator %7B%0A    // stats%0A    private final double mu;%0A    private final double background;%0A%0A    public DirichletRawScroingIterator(NodeParameters p, LengthsIterator ls, CountIterator it)%0A            throws IOException %7B%0A        super(p, ls, it);%0A%0A        // stats%0A        mu = p.get(%22mu%22, 1500D);%0A        long collectionLength = p.getLong(%22collectionLength%22);%0A        long collectionFrequency = p.getLong(%22nodeFrequency%22);%0A        background = (collectionFrequency %3E 0)%0A                ? (double) collectionFrequency / (double) collectionLength%0A                : 0.5 / (double) collectionLength;%0A    %7D%0A%0A    @Override%0A    public double score(ScoringContext c) %7B%0A        int count = ((CountIterator) iterator).count(c);%0A        int length = this.lengthsIterator.length(c);%0A        return dirichletScore(count, length);%0A    %7D%0A%0A    private double dirichletScore(double count, double length) %7B%0A        double numerator = count + (mu * background);%0A        double denominator = length + mu;%0A        return Math.log(numerator) - Math.log(denominator);%0A    %7D%0A%7D%0A

implement DirichletRawScoringIterator dirichlet-raw used by FieldRelevanceModelTraversal