diff --git a/src/main/java/io/anserini/search/SearchArgs.java b/src/main/java/io/anserini/search/SearchArgs.java index e2f0a34dc7..7694a6d4e7 100644 --- a/src/main/java/io/anserini/search/SearchArgs.java +++ b/src/main/java/io/anserini/search/SearchArgs.java @@ -103,6 +103,15 @@ public class SearchArgs { * setting seems reasonable and does not contradict Zhai and Lafferty. */ + @Option(name = "-qld", usage = "use query likelihood Dirichlet scoring model") + public boolean qld = false; + + @Option(name = "-qljm", usage = "use query likelihood Jelinek Mercer scoring model") + public boolean qljm = false; + + @Option(name = "-qljm.lambda", handler = StringArrayOptionHandler.class, usage = "Jelinek Mercer smoothing parameter") + public String[] qljm_lambda = new String[] {"0.1"}; + @Option(name = "-bm25", usage = "use BM25 scoring model") public boolean bm25 = false; diff --git a/src/main/java/io/anserini/search/SearchCollection.java b/src/main/java/io/anserini/search/SearchCollection.java index 777ef9632f..5c2f70308f 100644 --- a/src/main/java/io/anserini/search/SearchCollection.java +++ b/src/main/java/io/anserini/search/SearchCollection.java @@ -215,10 +215,14 @@ public void close() throws IOException { public List constructSimiliries() { // Figure out which scoring model to use. List similarities = new ArrayList<>(); - if (args.ql) { + if (args.ql || args.qld) { for (String mu : args.mu) { similarities.add(new TaggedSimilarity(new LMDirichletSimilarity(Float.valueOf(mu)), "mu:"+mu)); } + } else if (args.qljm) { + for (String lambda : args.qljm_lambda) { + similarities.add(new TaggedSimilarity(new LMJelinekMercerSimilarity(Float.valueOf(lambda)), "lambda:" + lambda)); + } } else if (args.bm25) { for (String k1 : args.k1) { for (String b : args.b) {