8000 Add bindings for BRIGHT topics and qrels by lilyjge · Pull Request #2881 · castorini/anserini · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add bindings for BRIGHT topics and qrels #2881

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 5, 2025
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
14 changes: 13 additions & 1 deletion src/main/java/io/anserini/eval/Qrels.java
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,19 @@ public enum Qrels {
CIRAL_V10_HA_TEST_B("qrels.ciral-v1.0-ha-test-b.tsv"),
CIRAL_V10_SO_TEST_B("qrels.ciral-v1.0-so-test-b.tsv"),
CIRAL_V10_SW_TEST_B("qrels.ciral-v1.0-sw-test-b.tsv"),
CIRAL_V10_YO_TEST_B("qrels.ciral-v1.0-yo-test-b.tsv");
CIRAL_V10_YO_TEST_B("qrels.ciral-v1.0-yo-test-b.tsv"),
BRIGHT_BIOLOGY("qrels.bright-biology.txt"),
BRIGHT_EARTH_SCIENCE("qrels.bright-earth-science.txt"),
BRIGHT_ECONOMICS("qrels.bright-economics.txt"),
BRIGHT_PSYCHOLOGY("qrels.bright-psychology.txt"),
BRIGHT_ROBOTICS("qrels.bright-robotics.txt"),
BRIGHT_STACKOVERFLOW("qrels.bright-stackoverflow.txt"),
BRIGHT_SUSTAINABLE_LIVING("qrels.bright-sustainable-living.txt"),
BRIGHT_PONY("qrels.bright-pony.txt"),
BRIGHT_LEETCODE("qrels.bright-leetcode.txt"),
BRIGHT_AOPS("qrels.bright-aops.txt"),
BRIGHT_THEOREMQA_THEOREMS("qrels.bright-theoremqa-theorems.txt"),
BRIGHT_THEOREMQA_QUESTIONS("qrels.bright-theoremqa-questions.txt");

private static Map<String, String> symbolFileDict = generateSymbolFileDict();

Expand Down
14 changes: 14 additions & 0 deletions src/main/java/io/anserini/search/topicreader/Topics.java
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,20 @@ public enum Topics {
CIRAL_V10_SW_DEV_MONO(TsvIntTopicReader.class, "topics.ciral-v1.0-sw-dev-native.tsv"),
CIRAL_V10_YO_DEV_MONO(TsvIntTopicReader.class, "topics.ciral-v1.0-yo-dev-native.tsv"),

// BRIGHT original queries
BRIGHT_BIOLOGY(TsvStringTopicReader.class, "topics.bright-biology.tsv.gz"),
BRIGHT_EARTH_SCIENCE(TsvStringTopicReader.class, "topics.bright-earth-science.tsv.gz"),
BRIGHT_ECONOMICS(TsvStringTopicReader.class, "topics.bright-economics.tsv.gz"),
BRIGHT_PSYCHOLOGY(TsvStringTopicReader.class, "topics.bright-psychology.tsv.gz"),
BRIGHT_ROBOTICS(TsvStringTopicReader.class, "topics.bright-robotics.tsv.gz"),
BRIGHT_STACKOVERFLOW(TsvStringTopicReader.class, "topics.bright-stackoverflow.tsv.gz"),
BRIGHT_SUSTAINABLE_LIVING(TsvStringTopicReader.class, "topics.bright-sustainable-living.tsv.gz"),
BRIGHT_PONY(TsvStringTopicReader.class, "topics.bright-pony.tsv.gz"),
BRIGHT_LEETCODE(TsvStringTopicReader.class, "topics.bright-leetcode.tsv.gz"),
BRIGHT_AOPS(TsvStringTopicReader.class, "topics.bright-aops.tsv.gz"),
BRIGHT_THEOREMQA_THEOREMS(TsvStringTopicReader.class, "topics.bright-theoremqa-theorems.tsv.gz"),
BRIGHT_THEOREMQA_QUESTIONS(TsvStringTopicReader.class, "topics.bright-theoremqa-questions.tsv.gz"),

// unused topics
CACM(CacmTopicReader.class, "topics.cacm.txt"),
NTCIR_EN_1(NtcirTopicReader.class, "topics.www1.english.txt"),
Expand Down
67 changes: 66 additions & 1 deletion src/test/java/io/anserini/eval/RelevanceJudgmentsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public int getQrelsCount(RelevanceJudgments qrels) throws IOException{

@Test
public void testTotalCount() {
assertEquals(171, Qrels.values().length);
assertEquals(183, Qrels.values().length);
}

@Test(expected = IOException.class)
Expand Down Expand Up @@ -1244,6 +1244,71 @@ public void testMrTyDiTh() throws IOException{
assertEquals(1368, getQrelsCount(qrels));
}

@Test
public void testBRIGHT() throws IOException{
RelevanceJudgments qrels;

qrels = RelevanceJudgments.fromQrels(Qrels.BRIGHT_BIOLOGY);
assertNotNull(qrels);
assertEquals(103, qrels.getQids().size());
assertEquals(372, getQrelsCount(qrels));

qrels = RelevanceJudgments.fromQrels(Qrels.BRIGHT_EARTH_SCIENCE);
assertNotNull(qrels);
assertEquals(116, qrels.getQids().size());
assertEquals(585, getQrelsCount(qrels));

qrels = RelevanceJudgments.fromQrels(Qrels.BRIGHT_ECONOMICS);
assertNotNull(qrels);
assertEquals(103, qrels.getQids().size());
assertEquals(800, getQrelsCount(qrels));

qrels = RelevanceJudgments.fromQrels(Qrels.BRIGHT_PSYCHOLOGY);
assertNotNull(qrels);
assertEquals(101, qrels.getQids().size());
assertEquals(692, getQrelsCount(qrels));

qrels = RelevanceJudgments.fromQrels(Qrels.BRIGHT_ROBOTICS);
assertNotNull(qrels);
assertEquals(101, qrels.getQids().size());
assertEquals(520, getQrelsCount(qrels));

qrels = RelevanceJudgments.fromQrels(Qrels.BRIGHT_STACKOVERFLOW);
assertNotNull(qrels);
assertEquals(117, qrels.getQids().size());
assertEquals(478, getQrelsCount(qrels));

qrels = RelevanceJudgments.fromQrels(Qrels.BRIGHT_SUSTAINABLE_LIVING);
assertNotNull(qrels);
assertEquals(108, qrels.getQids().size());
assertEquals(576, getQrelsCount(qrels));

qrels = RelevanceJudgments.fromQrels(Qrels.BRIGHT_PONY);
assertNotNull(qrels);
assertEquals(112, qrels.getQids().size());
assertEquals(2219, getQrelsCount(qrels));

qrels = RelevanceJudgments.fromQrels(Qrels.BRIGHT_LEETCODE);
assertNotNull(qrels);
assertEquals(142, qrels.getQids().size());
assertEquals(262, getQrelsCount(qrels));

qrels = RelevanceJudgments.fromQrels(Qrels.BRIGHT_AOPS);
assertNotNull(qrels);
assertEquals(111, qrels.getQids().size());
assertEquals(524, getQrelsCount(qrels));

qrels = RelevanceJudgments.fromQrels(Qrels.BRIGHT_THEOREMQA_THEOREMS);
assertNotNull(qrels);
assertEquals(76, qrels.getQids().size());
assertEquals(151, getQrelsCount(qrels));

qrels = RelevanceJudgments.fromQrels(Qrels.BRIGHT_THEOREMQA_QUESTIONS);
assertNotNull(qrels);
assertEquals(194, qrels.getQids().size());
assertEquals(439, getQrelsCount(qrels));
}

@Test
public void testBEIR() throws IOException{
RelevanceJudgments qrels;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void testIterateThroughAllEnums() {
String path = topic.path;
assertEquals(topic.readerClass, TopicReader.getTopicReaderClassByFile(path));
}
assertEquals(517, cnt);
assertEquals(529, cnt);
}

@Test
Expand Down Expand Up @@ -2127,6 +2127,22 @@ public void testBeirBgeBaseEn15Topics() throws IOException {
assertEquals(300, TopicReader.getTopics(Topics.BEIR_V1_0_0_SCIFACT_TEST_BGE_BASE_EN_15).keySet().size());
}

@Test
public void testBrightTopics() throws IOException {
assertEquals(103, TopicReader.getTopics(Topics.BRIGHT_BIOLOGY).keySet().size());
assertEquals(116, TopicReader.getTopics(Topics.BRIGHT_EARTH_SCIENCE).keySet().size());
assertEquals(103, TopicReader.getTopics(Topics.BRIGHT_ECONOMICS).keySet().size());
assertEquals(101, TopicReader.getTopics(Topics.BRIGHT_PSYCHOLOGY).keySet().size());
assertEquals(101, TopicReader.getTopics(Topics.BRIGHT_ROBOTICS).keySet().size());
assertEquals(117, TopicReader.getTopics(Topics.BRIGHT_STACKOVERFLOW).keySet().size());
assertEquals(108, TopicReader.getTopics(Topics.BRIGHT_SUSTAINABLE_LIVING).keySet().size());
assertEquals(112, TopicReader.getTopics(Topics.BRIGHT_PONY).keySet().size());
assertEquals(142, TopicReader.getTopics(Topics.BRIGHT_LEETCODE).keySet().size());
assertEquals(111, TopicReader.getTopics(Topics.BRIGHT_AOPS).keySet().size());
assertEquals(76, TopicReader.getTopics(Topics.BRIGHT_THEOREMQA_THEOREMS).keySet().size());
assertEquals(194, TopicReader.getTopics(Topics.BRIGHT_THEOREMQA_QUESTIONS).keySet().size());
}

@Test
public void testGetTopicsWithStringIdsFromFileWithTopicReader() {
Map<String, Map<String, String>> topics;
Expand Down
6 changes: 0 additions & 6 deletions src/test/java/io/anserini/search/topicreader/TopicsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,8 @@

import org.junit.Test;

import java.io.IOException;
import java.util.Map;
import java.util.SortedMap;

import static io.anserini.search.topicreader.Topics.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;

public class TopicsTest {

Expand Down
0