Python interface to the Anserini IR toolkit built on Lucene
Project description
Pyserini provides a simple Python interface to the Anserini IR toolkit via pyjnius.
Installation
Install via PyPI:
pip install pyserini
Usage
Here's a sample pre-built index on TREC Disks 4 & 5 to play with (used in the TREC 2004 Robust Track):
wget https://git.uwaterloo.ca/jimmylin/anserini-indexes/raw/master/index-robust04-20191213.tar.gz
tar xvfz index-robust04-20191213.tar.gz
Use the SimpleSearcher
for searching:
from pyserini.search import SimpleSearcher
searcher = SimpleSearcher('index-robust04-20191213/')
hits = searcher.search('hubble space telescope')
# Print the first 10 hits:
for i in range(0, 10):
print(f'{i+1:2} {hits[i].docid:15} {hits[i].score:.5f}')
# Grab the actual text:
hits[0].raw
For additional information, please refer to the Pyserini repository.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyserini-0.9.3.1.tar.gz
(57.8 MB
view hashes)
Built Distribution
pyserini-0.9.3.1-py3-none-any.whl
(57.9 MB
view hashes)
Close
Hashes for pyserini-0.9.3.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a1288ba53f8fccd0491c499ded44f382660b9fc62dc658b8c03a04f74d4e8a3e |
|
MD5 | 74895622514ac79243e45452e9faf4ea |
|
BLAKE2b-256 | f76dfb533f19c779492e9454c7e960b4da4233835ca5a5696ef4c0f9792dc265 |