当前位置: 首页>>代码示例>>Java>>正文


Java Judgment类代码示例

本文整理汇总了Java中org.galagosearch.core.eval.RetrievalEvaluator.Judgment的典型用法代码示例。如果您正苦于以下问题:Java Judgment类的具体用法?Java Judgment怎么用?Java Judgment使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Judgment类属于org.galagosearch.core.eval.RetrievalEvaluator包,在下文中一共展示了Judgment类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: create

import org.galagosearch.core.eval.RetrievalEvaluator.Judgment; //导入依赖的package包/类
/**
 * Creates a SetRetrievalEvaluator from data from loadRanking and loadJudgments.
 */
public static SetRetrievalEvaluator create(TreeMap<String, ArrayList<Document>> allRankings, TreeMap<String, ArrayList<Judgment>> allJudgments) {
    TreeMap<String, RetrievalEvaluator> evaluators = new TreeMap<String, RetrievalEvaluator>();

    for (String query : allRankings.keySet()) {
        ArrayList<Judgment> judgments = allJudgments.get(query);
        ArrayList<Document> ranking = allRankings.get(query);

        if (judgments == null || ranking == null) {
            continue;
        }

        RetrievalEvaluator evaluator = new RetrievalEvaluator(query, ranking, judgments);
        evaluators.put(query, evaluator);
    }

    return new SetRetrievalEvaluator(evaluators.values());
}
 
开发者ID:jjfiv,项目名称:galagosearch,代码行数:21,代码来源:Main.java

示例2: loadJudgments

import org.galagosearch.core.eval.RetrievalEvaluator.Judgment; //导入依赖的package包/类
/**
 * Loads a TREC judgments file.
 *
 * @param filename The filename of the judgments file to load.
 * @return Maps from query numbers to lists of judgments for each query.
 */
public static TreeMap<String, ArrayList<Judgment>> loadJudgments(String filename) throws IOException, FileNotFoundException {
    // open file
    BufferedReader in = new BufferedReader(new FileReader(filename));
    String line = null;
    TreeMap<String, ArrayList<Judgment>> judgments = new TreeMap<String, ArrayList<Judgment>>();
    String recentQuery = null;
    ArrayList<Judgment> recentJudgments = null;

    while ((line = in.readLine()) != null) {
        int[] columns = splits(line, 4);

        String number = line.substring(columns[0], columns[1]);
        String unused = line.substring(columns[2], columns[3]);
        String docno = line.substring(columns[4], columns[5]);
        String judgment = line.substring(columns[6]);

        Judgment j = new Judgment(docno, Integer.valueOf(judgment));

        if (recentQuery == null || !recentQuery.equals(number)) {
            if (!judgments.containsKey(number)) {
                judgments.put(number, new ArrayList<Judgment>());
            }

            recentJudgments = judgments.get(number);
            recentQuery = number;
        }

        recentJudgments.add(j);
    }

    in.close();
    return judgments;
}
 
开发者ID:jjfiv,项目名称:galagosearch,代码行数:40,代码来源:Main.java


注:本文中的org.galagosearch.core.eval.RetrievalEvaluator.Judgment类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。