Skip to content

Commit

Permalink
Modify model parameter option names
Browse files Browse the repository at this point in the history
  • Loading branch information
louislefevre committed Mar 27, 2021
1 parent 9807b20 commit b66590e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
6 changes: 3 additions & 3 deletions retrieval/DatasetParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ def parse(self, model: str, plot_freq: bool = False, smoothing: str = None,
index.plot()
if model == 'bm25':
model = BM25(index, self._mapping)
elif model == 'vector':
elif model == 'vs':
model = VectorSpace(index, self._mapping)
elif model == 'query':
elif model == 'lm':
model = QueryLikelihood(index, self._mapping, smoothing)
else:
raise ValueError("Invalid retrieval model - select 'bm25', 'vector', or 'query'.")
raise ValueError("Invalid retrieval model - select 'bm25', 'vs', or 'lm'.")

print("Ranking queries against passages...")
return {qid: model.rank(qid, query) for qid, query in self._queries.items()}
Expand Down
6 changes: 2 additions & 4 deletions start.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ def main():
parser = DatasetParser(dataset)
results = parser.parse(model, plot_freq=plot, smoothing=smoothing)

models = {'bm25': 'BM25', 'vector': 'VS', 'query': 'LM'}
smoothers = {'laplace': '-Laplace', 'lidstone': '-Lidstone', 'dirichlet': '-Dirichlet'}
model = models[model]
smoothing = smoothers[smoothing] if smoothing is not None else ""
model = model.upper()
smoothing = f'-{smoothing.capitalize()}' if smoothing is not None else ""

data = ''
for qid, passages in results.items():
Expand Down

0 comments on commit b66590e

Please sign in to comment.