本文整理汇总了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());
}
示例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;
}