From 90d01d3ea4b7e3f2b46fb6bc53dde24b07043db8 Mon Sep 17 00:00:00 2001 From: srishti1909 <144073291+srishti1909@users.noreply.github.com> Date: Mon, 2 Oct 2023 18:58:26 -0500 Subject: [PATCH] Update search_eval.py --- search_eval.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/search_eval.py b/search_eval.py index 6996cba..5bf8e1e 100755 --- a/search_eval.py +++ b/search_eval.py @@ -6,12 +6,22 @@ def load_ranker(cfg_file): - """ - Use this function to return the Ranker object to evaluate, - The parameter to this function, cfg_file, is the path to a - configuration file used to load the index. - """ - return metapy.index.OkapiBM25() + if 'cranfield' in cfg_file: + print('cranfield') + myRanker=metapy.index.OkapiBM25(k1=1.25,b=0.8,k3=0) + elif 'faculty' in cfg_file: + print('faculty') + myRanker=metapy.index.OkapiBM25(k1=0.5,b=0.8,k3=500) + elif 'news' in cfg_file: + print('news') + myRanker=metapy.index.OkapiBM25(k1=.95,b=0.3,k3=500) + else: + print('default') + myRanker=metapy.index.OkapiBM25(k1=1.25,b=0.8,k3=0) + + return myRanker + + #return metapy.index.OkapiBM25() if __name__ == '__main__': if len(sys.argv) != 2: