Skip to main content

Anserini is a retrieval toolkit built on top of Lucene. pyterrier-anserini provides a PyTerrier-compatible interface to Anserini, allowing you to easily run experiments and combine it with other systems.

Quick Start

You can install pyterrier-anserini with pip:

$ pip install pyterrier-anserini

pyterrier_anserini.AnseriniIndex is the main class for working with Anserini. For instance, you can download a pre-built index from HuggingFace and retrieve with BM25 using the following snippet:

>>> from pyterrier_anserini import AnseriniIndex
>>> index = AnseriniIndex.from_hf('macavaney/msmarco-passage.anserini')
>>> bm25 = index.bm25(include_fields=['contents'])
>>> bm25.search('terrier breeds')
  qid           query    docno    score  rank                                      contents
0   1  terrier breeds  5785957  11.9588     0  The Jack Russell Terrier and the Russell ...
1   1  terrier breeds  7455374  11.9343     1  FCI, ANKC, and IKC recognize the shorts a...
2   1  terrier breeds  1406578  11.8640     2  Norfolk terrier (English breed of small t...
3   1  terrier breeds  3984886  11.7518     3  Terrier Group is the name of a breed Grou...
4   1  terrier breeds  7728131  11.5660     4  The Yorkshire Terrier didn't begin as the...
...

Acknowledgements

This extension uses the Anserini package. If you use it, please be sure to cite Anserini:

@inproceedings{DBLP:conf/sigir/Yang0L17,
  author       = {Peilin Yang and
                  Hui Fang and
                  Jimmy Lin},
  title        = {Anserini: Enabling the Use of Lucene for Information Retrieval Research},
  booktitle    = {Proceedings of the 40th International {ACM} {SIGIR} Conference on
                  Research and Development in Information Retrieval, Shinjuku, Tokyo,
                  Japan, August 7-11, 2017},
  pages        = {1253--1256},
  publisher    = {{ACM}},
  year         = {2017},
  url          = {https://doi.org/10.1145/3077136.3080721},
  doi          = {10.1145/3077136.3080721}
}

This extension was built as part of the PyTerrier project. If you use it, please be sure to cite PyTerrier:

@inproceedings{DBLP:conf/cikm/MacdonaldTMO21,
  author       = {Craig Macdonald and
                  Nicola Tonellotto and
                  Sean MacAvaney and
                  Iadh Ounis},
  title        = {PyTerrier: Declarative Experimentation in Python from {BM25} to Dense
                  Retrieval},
  booktitle    = {{CIKM} '21: The 30th {ACM} International Conference on Information
                  and Knowledge Management, Virtual Event, Queensland, Australia, November
                  1 - 5, 2021},
  pages        = {4526--4533},
  publisher    = {{ACM}},
  year         = {2021},
  url          = {https://doi.org/10.1145/3459637.3482013},
  doi          = {10.1145/3459637.3482013}
}

This extension was written by Sean MacAvaney at the University of Glasgow and was based on an original implementation that was part of PyTerrier, written by Craig Macdonald. Check out the GitHub for a full list of contributors.

Metadata

Release files for pyterrier-anserini 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyterrier-anserini 0.2.2
File Size Uploaded
pyterrier_anserini-0.2.2.tar.gz 23.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyterrier-anserini 0.2.2
File Interpreter ABI Platform
pyterrier_anserini-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 51.0 kB

Release files / pyterrier_anserini-0.2.2.tar.gz

Download URL pyterrier_anserini-0.2.2.tar.gz
Size 23.4 kB
Tags Source
SHA-256 checksum
How to use checksums
5dd2425064a634c587c16836cc889db20548aec32a466cb0e9dae1438dfb6159
BLAKE2b-256 checksum
How to use checksums
77272ee8da10c4451ce18822cb33df36d8190bddb3aa8957358f3e9f72b834d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.5

Release files / pyterrier_anserini-0.2.2-py3-none-any.whl

Download URL pyterrier_anserini-0.2.2-py3-none-any.whl
Size 27.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a0d0b8088e88bf8a75d329ec7adab6bee860a1fd29e949ab8589d3254d0f13ae
BLAKE2b-256 checksum
How to use checksums
a57f8a981b430ffc4eb065e67288f5c1e657b27e9a7ce627e17e552008ba300c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.5

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page