samarthagarwal23 commited on
Commit
89b0019
1 Parent(s): 4df7b3c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -36,12 +36,6 @@ def bm25_tokenizer(text):
36
  tokenized_doc.append(token)
37
  return tokenized_doc
38
 
39
- tokenized_corpus = []
40
- for doc in docs:
41
- tokenized_corpus.append(bm25_tokenizer(doc))
42
-
43
- bm25 = BM25Okapi(tokenized_corpus)
44
-
45
  def retrieval(query, top_k_retriver, docs):
46
 
47
  bm25_scores = bm25.get_scores(bm25_tokenizer(query))
@@ -67,6 +61,12 @@ def qa_ranker(query, docs_, top_k_ranker):
67
 
68
  def final_qa_pipeline(file, query):
69
  docs = read_pdf(file)
 
 
 
 
 
 
70
  top_k_retriver, top_k_ranker = 10,1
71
  lvl1 = retrieval(query, top_k_retriver, docs)
72
 
 
36
  tokenized_doc.append(token)
37
  return tokenized_doc
38
 
 
 
 
 
 
 
39
  def retrieval(query, top_k_retriver, docs):
40
 
41
  bm25_scores = bm25.get_scores(bm25_tokenizer(query))
 
61
 
62
  def final_qa_pipeline(file, query):
63
  docs = read_pdf(file)
64
+ tokenized_corpus = []
65
+ for doc in docs:
66
+ tokenized_corpus.append(bm25_tokenizer(doc))
67
+
68
+ bm25 = BM25Okapi(tokenized_corpus)
69
+
70
  top_k_retriver, top_k_ranker = 10,1
71
  lvl1 = retrieval(query, top_k_retriver, docs)
72