io.github.repir.TestSet.Topic.TopicReaderSessionMapping Maven / Gradle / Ivy
The newest version!
package io.github.repir.TestSet.Topic;
import io.github.repir.Repository.Repository;
import io.github.repir.tools.io.Datafile;
import io.github.repir.tools.io.struct.StructuredTextCSV;
import io.github.repir.tools.io.struct.StructuredTextXML;
import io.github.repir.tools.lib.Log;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
/**
* Topic reader for TREC Web Track 2010-2013 ad-hoc topics.
*
* @author jer
*/
public class TopicReaderSessionMapping extends StructuredTextCSV {
public static Log log = new Log(TopicReaderSessionMapping.class);
public FolderNode session = this.createRoot();
public IntField sessionid = this.addInt("sessionid");
public IntField topicid = this.addInt("topicid");
public IntField subtopic = this.addInt("subtopic");
private TopicReaderSessionMapping(Repository repository) {
super(new Datafile(repository.configuredString("testset.mappings")));
datafile.setBufferSize((int) datafile.getLength());
}
public static void assignTopics(Repository repository, HashMap topics) {
TopicReaderSessionMapping m = new TopicReaderSessionMapping(repository);
m.openRead();
while (m.nextRecord()) {
TestSetTopic get = topics.get(m.sessionid.get());
get.qrelid = m.topicid.get();
}
m.closeRead();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy