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://www.dropbox.com/s/mdoly9sjdalh44x/lucene-index.robust04.pos%2Bdocvectors%2Brawdocs.tar.gz
tar xvfz lucene-index.robust04.pos+docvectors+rawdocs.tar.gz
Use the SimpleSearcher
for searching:
from pyserini.search import pysearch
searcher = pysearch.SimpleSearcher('lucene-index.robust04.pos+docvectors+rawdocs')
hits = searcher.search('hubble space telescope')
# Prints the first 10 hits
for i in range(0, 10):
print('{} {} {}'.format(i+1, hits[i].docid, hits[i].score))
# Grab the actual text
hits[0].content
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.7.0.0.tar.gz
(53.7 MB
view hashes)
Built Distribution
pyserini-0.7.0.0-py3-none-any.whl
(53.7 MB
view hashes)
Close
Hashes for pyserini-0.7.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ebeabac2f4fc817bee9a7cf6a0d3f3e4a11c3f48acaab9dd295cc8e5ab43dd2a |
|
MD5 | 62d4c8297ee2069446b35fd43c14dea1 |
|
BLAKE2b-256 | 7883ff90f524258ca07b54dce4c25c13b10dba547f518fc2944cf4c5e328b510 |