Skip to main content

Anserini + PyTerrier

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyterrier_anserini-0.1.3.tar.gz (19.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyterrier_anserini-0.1.3-py3-none-any.whl (23.1 kB view details)

Uploaded Python 3

File details

Details for the file pyterrier_anserini-0.1.3.tar.gz.

File metadata

  • Download URL: pyterrier_anserini-0.1.3.tar.gz
  • Upload date:
  • Size: 19.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for pyterrier_anserini-0.1.3.tar.gz
Algorithm Hash digest
SHA256 14c769ba0d08eefe6c5415b6b20501889f6de81b4bd3743761e1e2691db2adb9
MD5 5e81b8783837d1cbae4430aa59a7ce39
BLAKE2b-256 23f03dc0fc11233e69226c796bcc1caf9d0c5bab88e78533c114b4d37bad4593

See more details on using hashes here.

File details

Details for the file pyterrier_anserini-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for pyterrier_anserini-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ee6cd33f2039c6b2f14d7bba1247d3aca54b2de841c61805363cc19e050dbb88
MD5 ae55485ec63e8f662213305aa3bcbb61
BLAKE2b-256 c6d29958c593d3fe83a69fd192c980ddef09a75850af9a4dd7c24e5cece9c9c5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page