Library for working with TREC run files
Project description
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]installsir-measures, which is required byevaluate().pip install trecrun[all]additionally installssmart_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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file trecrun-0.4.3.tar.gz.
File metadata
- Download URL: trecrun-0.4.3.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ec598c6a4afa755893d1d9b91b31147b41f5f56270cb41cf1f9ed3b60cf830f
|
|
| MD5 |
3ca9b5ee83a595786f15696e4e50c252
|
|
| BLAKE2b-256 |
f94a55357ea170ede2ec5bb4a54c1a329742934d80f2457a694cc522836a2f0a
|
Provenance
The following attestation bundles were made for trecrun-0.4.3.tar.gz:
Publisher:
publish-release.yml on capreolus-ir/trecrun
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
trecrun-0.4.3.tar.gz -
Subject digest:
9ec598c6a4afa755893d1d9b91b31147b41f5f56270cb41cf1f9ed3b60cf830f - Sigstore transparency entry: 1791411512
- Sigstore integration time:
-
Permalink:
capreolus-ir/trecrun@5717bce21295fba8902a52b77c4a263aefaf55e8 -
Branch / Tag:
refs/tags/v0.4.3 - Owner: https://github.com/capreolus-ir
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-release.yml@5717bce21295fba8902a52b77c4a263aefaf55e8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file trecrun-0.4.3-py3-none-any.whl.
File metadata
- Download URL: trecrun-0.4.3-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
818a5efd5907e758ba0e7340401504a0e30a239411569a4750e94688c7cae7bc
|
|
| MD5 |
4ccc112cd25375f53da10f88a94d2fa5
|
|
| BLAKE2b-256 |
69d5b2df9f627b11c8747837f661359d8dada63a5c5868ea599b42e855e630da
|
Provenance
The following attestation bundles were made for trecrun-0.4.3-py3-none-any.whl:
Publisher:
publish-release.yml on capreolus-ir/trecrun
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
trecrun-0.4.3-py3-none-any.whl -
Subject digest:
818a5efd5907e758ba0e7340401504a0e30a239411569a4750e94688c7cae7bc - Sigstore transparency entry: 1791411771
- Sigstore integration time:
-
Permalink:
capreolus-ir/trecrun@5717bce21295fba8902a52b77c4a263aefaf55e8 -
Branch / Tag:
refs/tags/v0.4.3 - Owner: https://github.com/capreolus-ir
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-release.yml@5717bce21295fba8902a52b77c4a263aefaf55e8 -
Trigger Event:
push
-
Statement type: