Skip to content

Commit

Permalink
Try to get more results by changing must queries into should
Browse files Browse the repository at this point in the history
This tests different boost values and refs bst-mug#115.
  • Loading branch information
Michel Oleynik committed Jul 27, 2017
1 parent 9cd6e97 commit eadae63
Show file tree
Hide file tree
Showing 2 changed files with 125 additions and 0 deletions.
37 changes: 37 additions & 0 deletions src/main/java/at/medunigraz/imi/bst/trec/BoostExperimenter.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package at.medunigraz.imi.bst.trec;

import java.io.File;
import java.util.Set;

import at.medunigraz.imi.bst.trec.experiment.Experiment;
import at.medunigraz.imi.bst.trec.experiment.ExperimentsBuilder;

public class BoostExperimenter {
public static void main(String[] args) {
final File relaxedTemplate = new File(RunnerDemo.class.getResource("/templates/relaxed.json").getFile());

ExperimentsBuilder builder = new ExperimentsBuilder();

for (float i = 1; i <= 5; i += 0.5) {
builder.newExperiment().withGoldStandard(Experiment.GoldStandard.FINAL)
.withTarget(Experiment.Task.PUBMED).withKeyword(String.valueOf(i)).withTemplate(relaxedTemplate)
.withWordRemoval();
}

Set<Experiment> experiments = builder.build();

for (Experiment exp : experiments) {
exp.start();
try {
exp.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
}

for (Experiment exp : experiments) {

}
}

}
88 changes: 88 additions & 0 deletions src/main/resources/templates/relaxed.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{
"bool": {
"should": [
{
"multi_match": {
"query": "{{disease}}",
"fields": [
"title^2",
"abstract",
"keyword",
"meshTags"
],
"tie_breaker": 0.3,
"type": "best_fields",
"boost": {{keyword}}
}
},
{
"multi_match": {
"query": "{{gene}}",
"fields": [
"title^2",
"abstract",
"keyword",
"meshTags"
],
"tie_breaker": 0.3,
"type": "best_fields",
"boost": {{keyword}}
}
},
{
"match": {
"_type": "extra"
}
},
{
"bool": {
"should": {
"multi_match": {
"query": "cancer carcinoma tumor",
"fields": [
"title^2",
"abstract",
"keyword",
"meshTags"
],
"tie_breaker": 0.3,
"type": "best_fields"
}
}
}
},
{
"bool": {
"should": {
"multi_match": {
"query": "gene genotype DNA base",
"fields": [
"title^2",
"abstract",
"keyword",
"meshTags"
],
"tie_breaker": 0.3,
"type": "best_fields"
}
}
}
},
{
"bool": {
"should": {
"multi_match": {
"query": "therapy treatment prognosis prognostic survival patient resistance recurrence targets malignancy study therapeutical outcome",
"fields": [
"title^2",
"abstract"
],
"tie_breaker": 0.3,
"type": "best_fields"
}
}
}
}
]
}
}

0 comments on commit eadae63

Please sign in to comment.