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;
}
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;
}
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;
}
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);
}
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);
}
Aggregations