Spaces:
Sleeping
Sleeping
Commit
Β·
c2fe84b
1
Parent(s):
52b042a
update
Browse files- .gitignore +1 -0
- README.md +1 -1
- app.py +5 -3
- packages.txt +1 -0
.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
__pycache__
|
README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
emoji: π
|
| 4 |
colorFrom: pink
|
| 5 |
colorTo: purple
|
|
|
|
| 1 |
---
|
| 2 |
+
title: MSMarco BM25
|
| 3 |
emoji: π
|
| 4 |
colorFrom: pink
|
| 5 |
colorTo: purple
|
app.py
CHANGED
|
@@ -6,12 +6,14 @@ import os
|
|
| 6 |
if not os.path.exists('msmarco-passage'):
|
| 7 |
os.system('python -c "from pyserini.search import LuceneSearcher; LuceneSearcher.from_prebuilt_index(\'msmarco-passage\')"')
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
def search_pyserini(query):
|
| 10 |
try:
|
| 11 |
-
searcher = LuceneSearcher('msmarco-passage')
|
| 12 |
-
searcher.set_bm25(k1=0.9, b=0.4)
|
| 13 |
hits = searcher.search(query, k=10)
|
| 14 |
-
|
| 15 |
results = []
|
| 16 |
for i, hit in enumerate(hits):
|
| 17 |
doc = searcher.doc(hit.docid)
|
|
|
|
| 6 |
if not os.path.exists('msmarco-passage'):
|
| 7 |
os.system('python -c "from pyserini.search import LuceneSearcher; LuceneSearcher.from_prebuilt_index(\'msmarco-passage\')"')
|
| 8 |
|
| 9 |
+
|
| 10 |
+
searcher = LuceneSearcher('msmarco-passage')
|
| 11 |
+
searcher.set_bm25(k1=0.9, b=0.4)
|
| 12 |
+
|
| 13 |
+
|
| 14 |
def search_pyserini(query):
|
| 15 |
try:
|
|
|
|
|
|
|
| 16 |
hits = searcher.search(query, k=10)
|
|
|
|
| 17 |
results = []
|
| 18 |
for i, hit in enumerate(hits):
|
| 19 |
doc = searcher.doc(hit.docid)
|
packages.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
default-jre
|