Search in sources :

Example 6 with FeatureExtractors

use of io.anserini.ltr.feature.FeatureExtractors in project Anserini by castorini.

the class BigramFeaturesTest method getMixedChain.

private FeatureExtractors getMixedChain() {
    FeatureExtractors chain = new FeatureExtractors();
    chain.add(new OrderedSequentialPairsFeatureExtractor(2));
    chain.add(new OrderedSequentialPairsFeatureExtractor(4));
    chain.add(new OrderedSequentialPairsFeatureExtractor(6));
    chain.add(new UnorderedSequentialPairsFeatureExtractor(2));
    chain.add(new UnorderedSequentialPairsFeatureExtractor(4));
    chain.add(new UnorderedSequentialPairsFeatureExtractor(6));
    return chain;
}
Also used : FeatureExtractors(io.anserini.ltr.feature.FeatureExtractors) OrderedSequentialPairsFeatureExtractor(io.anserini.ltr.feature.OrderedSequentialPairsFeatureExtractor) UnorderedSequentialPairsFeatureExtractor(io.anserini.ltr.feature.UnorderedSequentialPairsFeatureExtractor)

Example 7 with FeatureExtractors

use of io.anserini.ltr.feature.FeatureExtractors in project Anserini by castorini.

the class BigramFeaturesTest method getUnorderedChain.

private FeatureExtractors getUnorderedChain() {
    FeatureExtractors chain = new FeatureExtractors();
    chain.add(new UnorderedSequentialPairsFeatureExtractor(2));
    chain.add(new UnorderedSequentialPairsFeatureExtractor(4));
    chain.add(new UnorderedSequentialPairsFeatureExtractor(6));
    return chain;
}
Also used : FeatureExtractors(io.anserini.ltr.feature.FeatureExtractors) UnorderedSequentialPairsFeatureExtractor(io.anserini.ltr.feature.UnorderedSequentialPairsFeatureExtractor)

Example 8 with FeatureExtractors

use of io.anserini.ltr.feature.FeatureExtractors in project Anserini by castorini.

the class BigramFeaturesTest method getAllPairsOrdered.

private FeatureExtractors getAllPairsOrdered() {
    FeatureExtractors chain = new FeatureExtractors();
    chain.add(new OrderedQueryPairsFeatureExtractor(2));
    chain.add(new OrderedQueryPairsFeatureExtractor(4));
    chain.add(new OrderedQueryPairsFeatureExtractor(6));
    return chain;
}
Also used : FeatureExtractors(io.anserini.ltr.feature.FeatureExtractors) OrderedQueryPairsFeatureExtractor(io.anserini.ltr.feature.OrderedQueryPairsFeatureExtractor)

Example 9 with FeatureExtractors

use of io.anserini.ltr.feature.FeatureExtractors in project Anserini by castorini.

the class FeatureExtractorChainFromJsonTest method testEmptyChain.

@Test
public void testEmptyChain() throws Exception {
    String jsonString = "{extractors: []}";
    JsonObject json = parser.parse(jsonString).getAsJsonObject();
    FeatureExtractors emptyChain = FeatureExtractors.fromJson(json);
    assertNotNull(emptyChain);
}
Also used : FeatureExtractors(io.anserini.ltr.feature.FeatureExtractors) JsonObject(com.google.gson.JsonObject) Test(org.junit.Test)

Example 10 with FeatureExtractors

use of io.anserini.ltr.feature.FeatureExtractors in project Anserini by castorini.

the class FeatureExtractorChainFromJsonTest method testMultipleExtractorMixed.

@Test
public void testMultipleExtractorMixed() throws Exception {
    String jsonString = "{extractors: [ {name: \"DocSize\"}, {name: \"QueryLength\"}," + "{name: \"OrderedSequentialPairs\", params:{gapSize: 2}}, {name: \"UnorderedSequentialPairs\", params:{gapSize : 2}}" + ", {name: \"OrderedSequentialPairs\", params:{gapSize: 5}} ]}";
    JsonObject json = parser.parse(jsonString).getAsJsonObject();
    String testText = "document test word word word  test bunch word document";
    String testQuery = "document test bunch";
    FeatureExtractors chain = FeatureExtractors.fromJson(json);
    // document test, test bunch, bunch document
    float[] expected = { 9f, 3f, 2f, 2f, 4f };
    assertFeatureValues(expected, testQuery, testText, chain);
}
Also used : FeatureExtractors(io.anserini.ltr.feature.FeatureExtractors) JsonObject(com.google.gson.JsonObject) Test(org.junit.Test)

Aggregations

FeatureExtractors (io.anserini.ltr.feature.FeatureExtractors)18 Test (org.junit.Test)6 JsonObject (com.google.gson.JsonObject)5 RerankerContext (io.anserini.rerank.RerankerContext)4 Qrels (io.anserini.util.Qrels)4 PrintStream (java.io.PrintStream)4 Directory (org.apache.lucene.store.Directory)4 FSDirectory (org.apache.lucene.store.FSDirectory)4 RerankerCascade (io.anserini.rerank.RerankerCascade)3 File (java.io.File)3 FileOutputStream (java.io.FileOutputStream)3 IndexReader (org.apache.lucene.index.IndexReader)3 BM25Similarity (org.apache.lucene.search.similarities.BM25Similarity)3 LMDirichletSimilarity (org.apache.lucene.search.similarities.LMDirichletSimilarity)3 CmdLineException (org.kohsuke.args4j.CmdLineException)3 CmdLineParser (org.kohsuke.args4j.CmdLineParser)3 OrderedSequentialPairsFeatureExtractor (io.anserini.ltr.feature.OrderedSequentialPairsFeatureExtractor)2 UnorderedSequentialPairsFeatureExtractor (io.anserini.ltr.feature.UnorderedSequentialPairsFeatureExtractor)2 Rm3Reranker (io.anserini.rerank.rm3.Rm3Reranker)2 RemoveRetweetsTemporalTiebreakReranker (io.anserini.rerank.twitter.RemoveRetweetsTemporalTiebreakReranker)2