Skip to content

Commit

Permalink
added qljm and qld options for Jelinek-Mercer and Dirichlet QL scoring (
Browse files Browse the repository at this point in the history
  • Loading branch information
tteofili authored and lintool committed Nov 30, 2018
1 parent e5b87f0 commit c1aac5e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/main/java/io/anserini/search/SearchArgs.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
6 changes: 5 additions & 1 deletion src/main/java/io/anserini/search/SearchCollection.java
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,14 @@ public void close() throws IOException {
public List<TaggedSimilarity> constructSimiliries() {
// Figure out which scoring model to use.
List<TaggedSimilarity> 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) {
Expand Down

0 comments on commit c1aac5e

Please sign in to comment.