Skip to main content

Library for working with TREC run files

Project description

License Worfklow PyPI version fury.io Code style: black

TRECRun

TRECRun is a library for working with TREC run files, with an API heavily inspired by PyTerrier's pipeline operators.

API Operator Description
TRECRun(results) Create a TRECRun object from a dictionary of results or a path to a run file in TREC format.
add(self, other), subtract, multiply, divide +, -, *, / Perform the given operation between self's document scores and other, which can be a TRECRun or a scalar.
topk(self, k) % Retain only the top-k documents for each qid after sorting by score.
intersect(self, other) & Retain only the queries and documents that appear in both self and other.
concat(self, other) Concat the documents in other and self, with those in other appearing at the end. Their scores will be modified to accomplish this.
normalize(self, method='rr') Normalize scores in self using RRF (rr), min-max scaling (minmax), or standardization (standard).
write_trec_run(self, outf) Write self to outfn in TREC format.
evaluate(self, qrels, metrics) Compute metrics for self using qrels and return a dict mapping metric names to their values for each QID. Metrics are computed by ir_measures.

Installation

pip install trecrun

The core library has no required dependencies. Optional features:

  • pip install trecrun[eval] installs ir-measures, which is required by evaluate().
  • pip install trecrun[all] additionally installs smart_open, which enables loading compressed and remote run files.

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

trecrun-0.4.2.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

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

trecrun-0.4.2-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file trecrun-0.4.2.tar.gz.

File metadata

  • Download URL: trecrun-0.4.2.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for trecrun-0.4.2.tar.gz
Algorithm Hash digest
SHA256 8e1095750db8045a66cec02a2afbf898a1b4eb6ad14b3232f8d15dc31e38ff8f
MD5 83d5c0fef7d79fefe3bc32e539656e0c
BLAKE2b-256 a143adee08ad75082c265d936e9b153945539cb56a72ba1cacde32689c30330e

See more details on using hashes here.

Provenance

The following attestation bundles were made for trecrun-0.4.2.tar.gz:

Publisher: publish-release.yml on capreolus-ir/trecrun

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file trecrun-0.4.2-py3-none-any.whl.

File metadata

  • Download URL: trecrun-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for trecrun-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0d7ef740bace4dc4116fa1b611b44a90268cd99aa5ee62d9f01c14c1ea821cc9
MD5 5b47c157515872c8a921aaa3ce159b70
BLAKE2b-256 02525450d115b53b8d0c5b5e9524922a4972aca041627a389bfb7d1c28f1cb75

See more details on using hashes here.

Provenance

The following attestation bundles were made for trecrun-0.4.2-py3-none-any.whl:

Publisher: publish-release.yml on capreolus-ir/trecrun

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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