samarthagarwal23 commited on
Commit
a3e1a90
1 Parent(s): d1391ee

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -38,9 +38,9 @@ def bm25_tokenizer(text):
38
  tokenized_doc.append(token)
39
  return tokenized_doc
40
 
41
- def retrieval(query, top_k_retriver, docs):
42
 
43
- bm25_scores = bm25.get_scores(bm25_tokenizer(query))
44
  top_n = np.argsort(bm25_scores)[::-1][:top_k_retriver]
45
  bm25_hits = [{'corpus_id': idx,
46
  'score': bm25_scores[idx],
@@ -70,7 +70,7 @@ def final_qa_pipeline(file, query):
70
  bm25 = BM25Okapi(tokenized_corpus)
71
 
72
  top_k_retriver, top_k_ranker = 10,1
73
- lvl1 = retrieval(query, top_k_retriver, docs)
74
 
75
  if len(lvl1) > 0:
76
  fnl_rank = qa_ranker(query, [l["docs"] for l in lvl1], top_k_ranker)
 
38
  tokenized_doc.append(token)
39
  return tokenized_doc
40
 
41
+ def retrieval(query, top_k_retriver, docs, bm25_):
42
 
43
+ bm25_scores = bm25_.get_scores(bm25_tokenizer(query))
44
  top_n = np.argsort(bm25_scores)[::-1][:top_k_retriver]
45
  bm25_hits = [{'corpus_id': idx,
46
  'score': bm25_scores[idx],
 
70
  bm25 = BM25Okapi(tokenized_corpus)
71
 
72
  top_k_retriver, top_k_ranker = 10,1
73
+ lvl1 = retrieval(query, top_k_retriver, docs, bm25)
74
 
75
  if len(lvl1) > 0:
76
  fnl_rank = qa_ranker(query, [l["docs"] for l in lvl1], top_k_ranker)