Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions src/main/java/io/anserini/reproduce/RunBright.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* Anserini: A Lucene toolkit for reproducible information retrieval research
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.anserini.reproduce;

import io.anserini.reproduce.RunRepro.Args;
import io.anserini.reproduce.RunRepro.TrecEvalMetricDefinitions;
import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.args4j.CmdLineParser;
import org.kohsuke.args4j.ParserProperties;

import java.util.HashMap;
import java.util.Map;

public class RunBright {

public static void main(String[] args) throws Exception {
Args brightArgs = new RunRepro.Args();
CmdLineParser parser = new CmdLineParser(brightArgs, ParserProperties.defaults().withUsageWidth(120));

try {
parser.parseArgument(args);
} catch (CmdLineException exception) {
System.err.println(exception.getMessage());
return;
}

RunRepro repro = new RunRepro("bright", new BrightMetricDefinitions(), brightArgs.printCommands, brightArgs.dryRun);
repro.run();
}

public static class BrightMetricDefinitions extends TrecEvalMetricDefinitions {
public BrightMetricDefinitions() {
super();
Map<String, Map<String, String>> bright = new HashMap<>();
String[] corpora = {
"biology", "earth-science", "economics", "psychology", "robotics", "stackoverflow",
"sustainable-living", "leetcode", "pony", "aops", "theoremqa-theorems", "theoremqa-questions"
};

// Populate the main map with key-value pairs
for (String corpus : corpora) {
Map<String, String> corpusMap = new HashMap<>();
corpusMap.put("nDCG@10", "-c -m ndcg_cut.10");
bright.put("bright-" + corpus, corpusMap);
}

metricDefinitions.put("bright", bright);
}
}

}
55 changes: 55 additions & 0 deletions src/main/resources/reproduce/bright.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
conditions:
- name: bm25
display: "BM25, bag-of-words baseline"
display_html: "BM25, bag-of-words baseline"
display_row: ""
command: java -cp $fatjar --add-modules jdk.incubator.vector io.anserini.search.SearchCollection -threads $threads -index bright-$topics -topics bright-$topics -output $output -bm25 -removeQuery
topics:
- topic_key: biology
eval_key: bright-biology
scores:
- nDCG@10: 0.1824
- topic_key: earth-science
eval_key: bright-earth-science
scores:
- nDCG@10: 0.2791
- topic_key: economics
eval_key: bright-economics
scores:
- nDCG@10: 0.1645
- topic_key: psychology
eval_key: bright-psychology
scores:
- nDCG@10: 0.1342
- topic_key: robotics
eval_key: bright-robotics
scores:
- nDCG@10: 0.1091
- topic_key: stackoverflow
eval_key: bright-stackoverflow
scores:
- nDCG@10: 0.1626
- topic_key: sustainable-living
eval_key: bright-sustainable-living
scores:
- nDCG@10: 0.1613
- topic_key: pony
eval_key: bright-pony
scores:
- nDCG@10: 0.0434
- topic_key: leetcode
eval_key: bright-leetcode
scores:
- nDCG@10: 0.2471
- topic_key: aops
eval_key: bright-aops
scores:
- nDCG@10: 0.0645
- topic_key: theoremqa-theorems
eval_key: bright-theoremqa-theorems
scores:
- nDCG@10: 0.0214
- topic_key: theoremqa-questions
eval_key: bright-theoremqa-questions
scores:
- nDCG@10: 0.0733