<commit_before>/*
 *  BSD License (http://www.galagosearch.org/license)
 */
package org.lemurproject.galago.core.eval.aggregate;

import org.lemurproject.galago.core.eval.metric.QueryEvaluator;
import org.lemurproject.galago.core.eval.metric.QueryEvaluatorFactory;

import org.lemurproject.galago.tupleflow.Parameters;

/**
 * Factory for QuerySetEvaluators
 *
 * @author sjh
 */
public class QuerySetEvaluatorFactory {

  public static QuerySetEvaluator instance(String metric, Parameters p) {

    String lowerMetric = metric.toLowerCase();
    // sum metrics:
    if (lowerMetric.equals("num_ret")
            || lowerMetric.equals("num_rel")
            || lowerMetric.startsWith("num_rel_ret")
            || lowerMetric.startsWith("num_unjug_ret")) {
      QueryEvaluator evalFn = QueryEvaluatorFactory.instance(metric, p);
      return new Sum(metric, evalFn);

      // mean metrics
    } else if (
            lowerMetric.equals("frac_unjug_ret")
            || lowerMetric.equals("map")
            || lowerMetric.equals("averagePrecision")
            || lowerMetric.equals("bpref")
            || lowerMetric.equals("r-prec")
            || lowerMetric.equals("rPrecision")
            || lowerMetric.equals("recip_rank")
            || lowerMetric.startsWith("ndcg")
            || lowerMetric.startsWith("err")
            || lowerMetric.startsWith("p")
            || lowerMetric.startsWith("r")<commit_msg>bugfix<commit_after>/*
 *  BSD License (http://www.galagosearch.org/license)
 */
package org.lemurproject.galago.core.eval.aggregate;

import org.lemurproject.galago.core.eval.metric.QueryEvaluator;
import org.lemurproject.galago.core.eval.metric.QueryEvaluatorFactory;

import org.lemurproject.galago.tupleflow.Parameters;

/**
 * Factory for QuerySetEvaluators
 *
 * @author sjh
 */
public class QuerySetEvaluatorFactory {

  public static QuerySetEvaluator instance(String metric, Parameters p) {

    String lowerMetric = metric.toLowerCase();
    // sum metrics:
    if (lowerMetric.equals("num_ret")
            || lowerMetric.equals("num_rel")
            || lowerMetric.startsWith("num_rel_ret")
            || lowerMetric.startsWith("num_unjug_ret")) {
      QueryEvaluator evalFn = QueryEvaluatorFactory.instance(metric, p);
      return new Sum(metric, evalFn);

      // mean metrics
    } else if (
            lowerMetric.startsWith("frac_unjug_ret")
            || lowerMetric.equals("map")
            || lowerMetric.equals("averagePrecision")
            || lowerMetric.equals("bpref")
            || lowerMetric.equals("r-prec")
            || lowerMetric.equals("rPrecision")
            || lowerMetric.equals("recip_rank")
            || lowerMetric.startsWith("ndcg")
            || lowerMetric.startsWith("err")
            || lowerMetric.startsWith("p")
            || lowerMetric.startsWith("r")
{'fraction_non_alphanumeric': 0.12812390003519888, 'fraction_numerical': 0.0, 'mean_word_length': 2.974825174825175, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6101729', 'n_tokens_mistral': 833, 'n_tokens_neox': 829, 'n_words': 119}